Delete directory

In this chapter you will learn:

  1. Delete Directory

Delete Directory

using System;/*from   j  a  va 2 s . co  m*/
using System.IO;

class MaionClass
{
  public static void Main(String[] args)
  {
    try
    {
      Directory.Delete(@"C:\WinNT\MyFoo");
      Directory.Delete(@"C:\WinNT\MyBar", true);
    }
    catch(IOException e)
    {
      Console.WriteLine(e.Message);
    }
  }
}

Next chapter...

What you will learn in the next chapter:

  1. Directory.Exists
Home » C# Tutorial » File, Path
File creation
Deleting Files
Put to recycle bin
File Exists
File moving
File size
File attribute
Set file attribute
File time change
File time
Random file name
Temporary file
Path
Directory creation
Delete directory
Path existance
Change the path
Current Path
Directory listing
Recursive Path Listing
Combine path
Calculate Directory Size
Invalid path characters
System path
Directory copy
Drive
Drive information
File access rule
File System watcher