Created
August 21, 2015 08:44
-
-
Save cmittendorf/b680d1a03aefa08583d7 to your computer and use it in GitHub Desktop.
A script to enable tracking the DocumentIdentifier for a file on OSX.
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
#!/usr/bin/env swift | |
import Foundation | |
let args = Process.arguments | |
if (args.count != 2) { | |
print("usage: \(args[0].lastPathComponent) <file>\n") | |
exit(-1) | |
} | |
let flag = UInt32(UF_TRACKED) | |
let fileName = args[1] as NSString | |
if 0 != chflags(fileName.UTF8String, flag) { | |
let error = String.fromCString(strerror(errno))! | |
print("Error changing flags: \(error)\n") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment