如何编辑文件夹/文件的修改日期? [英] How to edit the modified date of a folder/file?

查看:172
本文介绍了如何编辑文件夹/文件的修改日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用webdav和MKCOL方法的HttpWebRequest在SP中创建文件夹。

然后我使用WebClient上传文件。

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?

我正在寻找类似于 Directory.SetLastWriteTime File.SetLastWriteTime

推荐答案

您可以为此使用以下代码

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);

这篇关于如何编辑文件夹/文件的修改日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆