[C#] How to Copy a directory in C#

Byantonhyip

Mar 12, 2019 #how to copy a directory in c#, #how to copy a directory to another directory in c#, #how to copy a file from one directory to another in c#, #how to copy a file from one folder to another folder in c#.net, #how to copy a file into a directory in c#, #how to copy a file into a folder in c#, #how to copy a file into another directory in c#, #how to copy a file to another directory in c#, #how to copy a file to another folder in c#, #how to copy a file to folder in c#, #how to copy a folder from one directory to another in c#, #how to copy all files and folders in c#, #how to copy all files from one directory to another in c#, #how to copy all files in a directory to another directory in c#, #how to copy all files in directory c#, #how to copy all files in folder c#, #how to copy directories in c#, #how to copy directory in c#, #how to copy directory to another directory in c#, #how to copy excel file in c#, #how to copy file from one directory to another directory in c#, #how to copy file in c#, #how to copy file in folder using c#, #how to copy file to another folder in c#, #how to copy file to directory in c#, #how to copy file to folder in c#, #how to copy files and folder in c#, #how to copy files and folders in c#, #how to copy files from one directory to another directory in c#, #how to copy files in directory c#, #how to copy files to another folder in c#, #how to copy folder and subfolders in c#, #how to copy folders in c#, #how to copy one directory to another directory in c#, #how to copy one file to another folder in c#, #how to copy text file in c#, #how to copy whole directory in c#, #how to copy xml file in c#
Chia sẻ

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());

 

ĐĂNG KÝ MUA HÀNG

    Email (*)

    Điện thoại (*)

    Tên sản phẩm/Dịch vụ:


    Chia sẻ
    Xem thêm  [C#] How to Move a File in C#

    Trả lời

    Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *