开发者

Force update file timestamp in VB.net

I am using the following code to copy a file:

System.IO.File.Copy(strOldFile, strNewFile) 

But the trouble is that the newly开发者_运维知识库-created file inherits the old file's timestamp. Is there a way to force the timestamp to update?


You can edit the CreationTime using the FileInfo class.

Dim path = Path.GetTempFileName();
Dim fi As New FileInfo(path)
fi.CreationTime = DateTime.Now;
fi.LastWriteTime = DateTime.Now;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜