Skip to content

Instantly share code, notes, and snippets.

@flandy84
Created February 5, 2012 00:50
Show Gist options
  • Save flandy84/1741580 to your computer and use it in GitHub Desktop.
Save flandy84/1741580 to your computer and use it in GitHub Desktop.
iOS "skip backup" file/directory flag
#include <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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment