May 02, 2013
Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
|CreateDirectory||Creates all directories and subdirectories as specified by path.|
|Delete(String)||Deletes an empty directory from a specified path.|
|Delete(String, Boolean)||Deletes the specified directory and, if indicated, any subdirectories and files in the directory.|
|Exists||Determines whether the given path refers to an existing directory on disk.|
|GetCreationTime||Gets the creation date and time of a directory.|
|GetCurrentDirectory||Gets the current working directory of the application.|
|GetDirectories(String)||Gets the names of subdirectories (including their paths) in the specified directory.|
|GetDirectories(String, String)||Gets an array of directories (including their paths) that match the specified search pattern in the current directory.|
|GetDirectoryRoot||Returns the volume information, root information, or both for the specified path.|
|GetFiles(String)||Returns the names of files in the specified directory.|
|GetFiles(String, String)||Returns the names of files in the specified directory that match the specified search pattern.|
|GetFileSystemEntries(String)||Returns the names of all files and subdirectories in the specified directory.|
|GetFileSystemEntries(String, String)||Returns an array of file system entries matching the specified search criteria.|
|GetLastAccessTime||Returns the date and time the specified file or directory was last accessed.|
|GetLastWriteTime||Returns the date and time the specified file or directory was last written to.|
|Move||Moves a file or a directory and its contents to a new location.|
|SetCurrentDirectory||Security Critical. Sets the application's current working directory to the specified directory.|
Use the class for typical operations such as copying, moving, renaming, creating, and deleting directories. You can also use the class to get and set DateTime information related to the creation, access, and writing of a directory.
Because all methods are static, it might be more efficient to use a method rather than a corresponding DirectoryInfo instance method if you want to perform only one action. Most methods require the path to the directory that you are manipulating.
The static methods of the class perform security checks on all methods. If you are going to reuse an object several times, consider using the corresponding instance method of DirectoryInfo instead, because the security check will not always be necessary.
In members that accept a path as an input string, that path must be well-formed or an exception is raised; however, if a path is fully qualified but begins with a space, the space is not omitted but no exception is raised. Similarly, a path or a combination of paths cannot be fully qualified twice. For example, "c:\temp c:\windows" also raises an exception in most cases. Ensure that your paths are well-formed when using methods that accept a path string.
In members that accept a path, the path can refer to a file or just a directory.
Windows PhoneThis type is present to support the .NET Compact Framework infrastructure in Windows Phone, and it is not intended to be used in your application code.