Created
October 4, 2020 12:05
-
-
Save abjurato/57bc8a48751b190dbb70a767e96d9f4d to your computer and use it in GitHub Desktop.
Exclude file from backup and set data protection key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension FileManager { | |
public func secureFilesystemItems(_ url: inout URL) throws { | |
try (url as NSURL).setResourceValue(URLFileProtection.completeUntilFirstUserAuthentication, forKey: .fileProtectionKey) | |
try (url as NSURL).setResourceValue(NSNumber(true), forKey: URLResourceKey.isExcludedFromBackupKey) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment