Home > Net >  C # the folder on common operations: new, delete, copy, move, the access and modification properties
C # the folder on common operations: new, delete, copy, move, the access and modification properties

Time:09-26

In the c # language class through the Directory to create, copy, delete, and move the folder, provides some static method in the Directory category, using these methods can complete the above functions, but objects can't build Directory), the Directory Info using method and Directory basic same, but DirectoryInfo object can be set up class, when using these two classes need to reference System. IO namespace, here with emphasis on the usage of the Directory category,

CreateDirectory: according to the specified path to create all the folder and subfolders,
Delete: Delete the specified folder,
The Exists: check the folders specified path Exists, Exists, returns true,
GetCreationTime: returns the specified file or folder creation date and time,
GetCurrentDirectory: access to the application of the current working folder,
GetDirectories: get the subfolders of the specified folder name,
GetDirectoryRoot: returns the specified path information, information, or both at the same time return,
GetFiles: returns the name of the specified folder neutron file,
GetFileSystemEntries: return all files in the folder and the specified file name,
GetLastAccessTime: returns the last access to the specified file or folder creation date and time,
GetLastWriteTime: returns the last write to the specified file or folder to create the date and time,
GetLogicalDrives: retrieve all the drives in the computer, such as: A, C, etc.,
GetParent: the specified path of the parent folder, including absolute and relative paths,
Move: Move the specified file or folder and its contents to a new location,
SetCreationTime: sets the creation date and time of the specified file or folder,
SetCurrentDirectory: the application of the current working folder Settings specified folder,
SetLastAccessTime: set the last access date and time of the specified file or folder,
SetLastWriteTime: set last time write the date and time of the specified folder,

CodePudding user response:

Blogging corner

CodePudding user response:

CodePudding user response:

The notes to write blog, or use the cloud notes