#import “sys/xattr.h”
– (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);}
,世上没有绝望的处境,只有对处境绝望的人。