问题
I am creating folders in SP using webdav with HttpWebRequest, MKCOL method.
And I upload files using WebClient.
For both uploaded files and created folders, how can I set their modified date?
I am looking for something similar to Directory.SetLastWriteTime
, File.SetLastWriteTime
回答1:
You can use following code for that
//Change the file created time.
File.SetCreationTime(path, dtCreation);
//Change the file modified time.
File.SetLastWriteTime(path, dtModified);
回答2:
string path = @"c:\DirName";
Directory.SetLastWriteTime(path, DateTime.Now);
dt = Directory.GetLastWriteTime(path);
来源:https://stackoverflow.com/questions/21280547/how-to-edit-the-modified-date-of-a-folder-file