Coloring file labels in OSX using R

No replies
Steve
User offline. Last seen 3 years 19 weeks ago. Offline
Joined: 08/15/2010

I wanted to flag tree files where there are a large number of suspect taxa (or a small number, etc) so this code snippet uses the xattr command to color the file label as it shows in the Finder, depending on the value of the PruneTaxa variable

# color file by state
FirstPart = "00 00 00 00 00 00 00 00 00 "
SecondPart = "00 00 00 00 00 00\n00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
Orange = "0E"
Purple = "06"
Grey = "02"
Yellow = "0A"
FileColor = Orange
if (length(PruneTaxa) > 5) {
AttrCommand = paste("xattr -wx com.apple.FinderInfo \"",FirstPart, FileColor, SecondPart,"\" ", FileName ,sep="")
system(AttrCommand)
}