How to edit the modified date of a folder/file?

后端 未结 2 1728
孤独总比滥情好
孤独总比滥情好 2021-01-22 09:26

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

相关标签:
2条回答
  • 2021-01-22 09:38

    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);
    
    0 讨论(0)
  • 2021-01-22 09:52
     string path = @"c:\DirName";
     Directory.SetLastWriteTime(path, DateTime.Now);
     dt = Directory.GetLastWriteTime(path);
    
    0 讨论(0)
提交回复
热议问题