1

I try to sync to folders, but with exceptions made by tags. So I learned, that I need different commands to build up that job. First I create a file of excluded files, which have a tag in orange or red set.

Then I call rsync with this output file as the no-do-list. But the content of the file is an absolute file name, while rsync seems to need relative path.

This is what I already have (need local language for names!):

mdfind -onlyin . "kMDItemUserTags == 'Orange' || kMDItemUserTags == 'Rot'" > excluded.txt 

And this is the one I need to get run:

rsync -avz --exclude-from "excluded.txt" source/ destination/

Any ideas?

Additional infos for better reading: Now with "sed", I get:

./Gruppe/A-Teens
./Gruppe/A-Teens/A - Teens - Mama Mia.mp3
./Gruppe/A-Teens/A - Teens - Super Trouper.mp3

Unfortunately this does not work. Again everything is copied. Actual statements:

cd /Users/serveruser/Desktop/fasttemp/temp/Unser/Songs

mdfind -onlyin . "kMDItemUserTags == 'Orange' || kMDItemUserTags == 'Rot'" | sed 's|/Users/serveruser/Desktop/fasttemp/temp/Unser/Songs|.|' > excluded.txt
rsync -avz --exclude-from "excluded.txt" /Users/serveruser/Desktop/fasttemp/temp/Unser/Songs/ /Users/serveruser/Desktop/fasttemp/temp/Unser/Backup/
0

1 Answer 1

3

Assuming you need to remove the leading part of the path, you can use sed to make it relative.

mdfind -onlyin . "kMDItemUserTags == 'Rot'" | sed 's|/PATH/TO/REMOVE/||' > excluded.txt
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .