Skip to content

Instantly share code, notes, and snippets.

@brocoo
Created April 23, 2014 14:00
Show Gist options
  • Save brocoo/11216259 to your computer and use it in GitHub Desktop.
Save brocoo/11216259 to your computer and use it in GitHub Desktop.
This method should be implemented in a NSURL category
- (BOOL)addSkipBackupAttribute{
if (![[NSFileManager defaultManager] fileExistsAtPath:[self path]]) return NO;
NSError *error = nil;
BOOL success = [self setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
if(!success){
NSLog(@"Error excluding %@ from backup %@", [self lastPathComponent], error);
}
return success;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment