File and Directory Manipulation

using System.IO;
class TestDirectory {
public static void Main() {

The above lines of codes will create a directory in your C:
Please note that the backslash(\) should be escaped by another backslash since it is a escape character. Moreover, remember to “using” the System.IO namespace so as to use these classes.
Following are a list of useful methods:

1. To create a subdirectory “dump” in C:\csharp just created:

2. To move a directory from one place to another:
Directory.Move(“C:\\csharp\\hello”, “C:\\hello”);

3. To delete a directory:

4. To copy a file to another location, or to a different name:
File.Copy( “c:\\friends.jpg”, “c:\\temp\\abc.jpg”);

5. To move a file from one place to another:
File.Move( “c:\\friends.jpg”, “c:\\temp\\friends.jpg”);

6. To delete a file:
File.Delete( “c:\\friends.jpg” );