Rsync filter: "OS X label"

On OS X, can I rsync selectively based on the file label as set in the Finder?

e.g. rsync all files and directories labelled "green".


Solution 1:

Not with rsync alone. rsync doesn't know how to read or act on OS X file meta data, which labels happen to be. But, you can pass rsync an explicit list of files to sync. Combine this with the fact that you can use mdls to read label information on files from the command line and you could build a list of files and send that list to rsync.

> mdls -name kMDItemFSLabel Amanda\ Palmer\ \&\ The\ Grand\ Theft\ Orchestra\ --\ Do\ It\ With\ a\ Rockstar.mp3 
kMDItemFSLabel = 4