C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » .Net » C# programs

Directory class programs/example in C#.Net

This section contains solved programs/example on C#.Net Directory class like creating directories, sub directories, get the list of directories, sub directories, check, delete directories etc.

List of C# Directory class examples/programs

  1. C# program to get the list of files from given directory.
    In this program, we will learn how to get filenames of given directory using C# code? To get filename of given directory, we have to use static method GetFiles() of Directory class.
  2. C# program to get root directory of given directory.
    In this program, we will learn how to get root directory of given directory using C# code? To get root directory, we have to use static method GetDirectoryRoot() of Directory class.
  3. C# program to search directory in a given directory.
    In this program, we will learn how to search directory in a given directory (path) using C# code? To search directory, we have to use static method GetDirectories() of Directory class.
  4. C# program to get computer drive names of given directory.
    In this program, we will learn how to get computer drive names using C# code? To get computer drive names, we have to use static method GetLogicalDrives() of Directory class.
  5. C# program to get the list of sub-directories of given directory.
    In this program, we will learn how to get the list of sub-directories of given directory using C# code? To get sub-directories, we have to use static method GetDirectories() of Directory class.
  6. C# program to get complete path of current directory.
    In this program, we will learn how to get complete path of current directory using C# code? To get path of current directory, we have to use static method GetCurrentDirectory() of Directory class.
  7. C# program to check given directory exists or not.
    In this program, we will learn how to check given directory is exist or not using C# code? To check directory existence, we have to use static method Exist() of Directory class.
  8. C# program to delete an empty and a non-empty directory.
    In this program, we will learn how to delete or remove directory or sub-directories using C# code? To delete directory, we have to use static method Delete() of Directory class.
  9. C# program to create directory.
    In this program, we will learn how to create directory or sub-directories using c# code? To create directory, we have to use static method CreateDirectory() of Directory class.



COMMENTS