C# DirectoryInfo Class - DirectoryInfo Class in C# with Examples
Directory Info Constructors
| Methods |
Description |
| Create ()
|
It is used to create a directory. |
| Create (Directory Security)
|
It is used to create a directory using a Directory Security object. |
| Create Obj Ref (Type)
|
It is used to create an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. |
| Create Sub directory (String)
|
It is used to create a subdirectory or subdirectories on the specified path. |
| Create Subdirectory (String,DirectorySecurity)
|
It is used to create a subdirectory or subdirectories on the specified path with the specified security. |
| Delete ()
|
It is used to delete this Directory Info if it is empty. |
| Delete (Boolean)
|
It is used to delete this instance of a Directory Info, specifying whether to delete subdirectories and files. |
| Enumerate Directories ()
|
It returns an enumerable collection of directory information in the current directory. |
| Enumerate Files ()
|
It returns an enumerable collection of file information in the current directory. |
| Get Access Control ()
|
It is used to get a Directory Security object that encapsulates the access control list (ACL) entries for the directory. |
| Get Directories ()
|
It returns the subdirectories of the current directory. |
| Get Files ()
|
It returns a file list from the current directory. |
| Get Type ()
|
It is used to get the Type of the current instance. |
| Move To (String)
|
It is used to move a Directory Info instance and its contents to a new path. |
| Refresh ()
|
It is used to refresh the state of the object. |
| Set Access Control (Directory Security)
|
It is used to set access control list (ACL) entries described by a Directory Security object. |
| To String ()
|
It returns the original path that was passed by the user. |
Directory Info Properties
| Properties |
Description |
| Attributes
|
It is used to get or set the attributes for the current file or directory. |
| Creation Time |
It is used to get or set the creation time of the current file or directory. |
| Creation Time Utc |
It is used to get or set creation time, in coordinated universal time (UTC). |
| Exists |
It is used to get a value indicating whether the directory exists. |
| Extension |
It is used to get the string representing the extension part of the file. |
| Full Name |
It is used to get the full path of the directory. |
| Last Access Time |
It is used to get or set the time the current file or directory was last accessed. |
| Last Access Time Utc |
It is used to get or set the time, in coordinated universal time (UTC) that the current file or directory was last accessed. |
| Last Write Time |
It is used to get or set the time when the current file or directory was last written. |
| Last Write Time Utc |
It is used to get or set the time, in coordinated universal time (UTC), when the current file or directory was last written. |
| Name |
It is used to get the name of this Directory Info instance.
|
| Parent |
It is used to get the parent directory of a specified subdirectory. |
| Root |
It is used to get the root portion of the directory. |