Skip to content

Instantly share code, notes, and snippets.

@NaanProphet
Created May 25, 2018 14:26
Show Gist options
  • Save NaanProphet/b56866bddd65d7c7be20740496ffb66b to your computer and use it in GitHub Desktop.
Save NaanProphet/b56866bddd65d7c7be20740496ffb66b to your computer and use it in GitHub Desktop.
Determine Finder Label Color from Terminal
# 0 = no colour
# 1 = orange
# 2 = red
# 3 = yellow
# 4 = blue
# 5 = purple
# 6 = green
# 7 = grey
getlabel() {
osascript - "$@" << EOF
on run argv
tell application "Finder"
set theArg to POSIX file (argv) as alias
set labelIndex to (get label index of theArg)
do shell script("echo " & labelIndex)
end tell
end run
EOF
}
# special thanks to:
# https://stackoverflow.com/questions/1464641/how-to-see-what-label-color-is-on-a-file-folder-from-within-termnal-mac-os-x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment