Set date modified for files in Cocoa

How can I set the date change attribute in a Cocoa file? Thanks

+7
source share
1 answer

What about the 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 the date of change with the NSFileModificationDate key.

Basically:

 NSDictionary* attr = [NSDictionary dictionaryWithObjectsAndKeys: yourDate, NSFileModificationDate, NULL]; [[NSFileManager defaultManager] setAttributes: attr ofItemAtPath: yourPath error: NULL]; 
+20
source

All Articles