【发布时间】:2018-03-18 16:48:17
【问题描述】:
我正在尝试设置一个循环来修改@"C:\testFolder" 中所有目录的日期。到目前为止,我的代码粘贴在下面,感谢您的帮助。
static void Main()
{
string n = @"C:\testFolder";
DateTime dtime1 = new DateTime(2015, 1, 3);
if (Directory.Exists(n))
Directory.SetCreationTime(n, dtime1);
Directory.SetLastWriteTime(n, dtime1);
Console.WriteLine("Done");
}
【问题讨论】:
-
问题会是......
-
当我尝试更改“测试文件夹”内所有目录的日期时,它似乎正在尝试更改“测试文件夹”的时间戳。程序崩溃,我得到一个“IOException washandled - The process cannot access the file c:\testFolder because it is being used by another process. @SamAxe