美文网首页
阻止文件被同步

阻止文件被同步

作者: IceWall_Rin | 来源:发表于2017-01-06 18:33 被阅读15次

- (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);

}

相关文章

网友评论

      本文标题:阻止文件被同步

      本文链接:https://www.haomeiwen.com/subject/izrxbttx.html