You want to delete, rename, or check if a directory exists. Or, you want to retrieve information about a directory such as its attributes or creation date.
Create a DirectoryInfo instance for the directory, and use its properties and methods.
The DirectoryInfo object works almost the same as the FileInfo object. You can use the same properties for retrieving attributes, names, and file system timestamps. You can also use the same methods for moving, deleting, and renaming directories as you would with files. These members are described in Table 5-1. In addition, the DirectoryInfo object provides some directory-specific members, which are shown in Table 5-3.
Table 5-3. DirectoryInfo Members