[Pythonmac-SIG] Reading Finder Labels on Folders

Caleb Land redhatdude at gmail.com
Tue Mar 22 22:09:40 CET 2005


Hello,
I'm writing a backup rsync script in python (who hasn't?), but I want
to be able to specify directories and files to exclude in the backup
based on the file/folder's label color in the finder.  I don't know
anything about Carbon but I managed to scrape together code to read
the label color of files:

def getFileLabel(path):
    filespec = Carbon.File.FSSpec(path)
    if not os.path.isdir(path):
        finfo = filespec.FSpGetFInfo()
    else:
        finfo = filespec.FSpGetFInfo()
    return labels[getLabelNumber(finfo.Flags)]

The problem is that this doesn't work on directories.  Is there a way
I can read the label on folders from python?

Thanks.

By the way, if anybody wants my script when I'm done with it just mail
me and I'll send you a copy.
-- 
Caleb Land
(RedHatDude at gmail.com)


More information about the Pythonmac-SIG mailing list