更改文件的修改日期?

axb*_*eit 0 c# file uwp

在我的本地文件夹中,我有一个文件sample.txt

右键单击 -> 属性 -> 详细信息

我可以看到它的修改日期。例如 2018 年 10 月 30 日 09:00。

我可以通过 UWP 更改此属性吗?以2018年10月20日 09:00 为例。

Ham*_*der 5

是的,你可以通过以下方式做到这一点

string path = @"c:\sample.txt";

// Take an action that will affect the write time.
File.SetLastWriteTime(path, new DateTime(1985,4,3));
Run Code Online (Sandbox Code Playgroud)