daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Jul 22nd, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NSFileManager *fileManager = [NSFileManager defaultManager];
  2. NSDate *now = [NSDate date];
  3. NSDictionary *timestampAttr = [NSDictionary dictionaryWithObjectsAndKeys:
  4.                                       now, NSFileCreationDate, now, NSFileModificationDate, nil];
  5. BOOL ret = [fileManager setAttributes:timestampAttr ofItemAtPath:path error:&err];
  6.    
  7. #import <Cocoa/Cocoa.h>
  8.  
  9. int main(void)
  10. {
  11.     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  12.     NSFileManager *m = [NSFileManager defaultManager];
  13.     NSString *path = ...;
  14.     [m setAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSDate date],NSFileCreationDate,nil] ofItemAtPath:path error:nil];
  15.     [pool drain];
  16.     return 0;
  17. }
  18.    
  19. NSFileManager *fileManager = [NSFileManager defaultManager];
  20. NSDate *now = [NSDate date];
  21. NSDictionary *creationDateAttr = [NSDictionary dictionaryWithObjectsAndKeys: now, NSFileCreationDate, nil];
  22. NSDictionary *modificationDateAttr = [NSDictionary dictionaryWithObjectsAndKeys: now, NSFileModificationDate, nil];
  23. [fileManager setAttributes:modificationDateAttr ofItemAtPath:path error:&err];
  24. [fileManager setAttributes:creationDateAttr ofItemAtPath:path error:&err];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top