阻止文件被同步

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL {

const char* filePath = [[URL path] fileSystemRepresentation];

const char* attrName = "com.apple.MobileBackup";

u_int8_t attrValue = 1;

int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);

return result == 0;

}

- (void)addSkipBackupAttributeToPath:(NSString*)path {

u_int8_t b = 1;

setxattr([path fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);

}

你可能感兴趣的:(阻止文件被同步)