[英]Touch a file in objective-c
I need to update the modification time of a file from a cocoa application. 我需要从cocoa应用程序更新文件的修改时间。 Any suggestion? 有什么建议吗?
Use NSFileManager
's setAttributes:ofItemAtPath:error:
method with the NSFileModificationDate
attribute. 使用NSFileManager
的setAttributes:ofItemAtPath:error:
方法和NSFileModificationDate
属性。
(See the class reference but also the associated "File System Programming Guide" which is worth reading) (参见类参考, 还有相关的“文件系统编程指南” ,值得一读)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.