How can I set the date modified attribute of a file in Cocoa? Thanks
What about NSFileManager
setAttributes:ofItemAtPath:error:
method?
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
Attributes are a dictionary. You can set a modification date value with the NSFileModificationDate
key.
Basically:
NSDictionary* attr = [NSDictionary dictionaryWithObjectsAndKeys: yourDate, NSFileModificationDate, NULL];
[[NSFileManager defaultManager] setAttributes: attr ofItemAtPath: yourPath error: NULL];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With