There is no method to copy a directory. The copying a directory is a process of creating a new directory that you to want a directory to move to and then copying subdirectory and files.
Nội dung
Get and Set Directory Creation Time
The SetCreationTime and GetCreationTime methods are used to set and get the creation date and time of the specified file. The following code snippet sets and gets the creation time of a file.
// Get and set file creation time string fileName = @"c:tempfiletodelete.txt"; File.SetCreationTime(fileName, DateTime.Now); DateTime dt = File.GetCreationTime(fileName); Console.WriteLine("File created time: {0}", dt.ToString());
Get and Set File Last Access Time
The SetLastAccessTime and GetLastAccessTime methods are used to set and get the last access date and time of the specified file. The following code snippet sets and gets the last access date and time of a file.
// Get and set file last access time string fileName = @"c:tempfiletodelete.txt"; File.SetLastAccessTime(fileName, DateTime.Now); DateTime dt = File.GetLastAccessTime(fileName); Console.WriteLine("File last access time: {0}", dt.ToString());
Get and Set File Last Write Time
The SetLastWriteTime and GetLastWriteTime methods are used to set and get the last write date and time of the specified file. The following code snippet sets and gets the last write date and time of a file.
// Get and set file last write timestring fileName = @"c:tempfiletodelete.txt"; File.SetLastWriteTime(fileName, DateTime.Now); DateTime dt = File.GetLastWriteTime(fileName); Console.WriteLine("File last write time: {0}", dt.ToString());