Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zqbobs

macrumors member
Original poster
Mar 10, 2009
66
18
I have a large number of scanned photos (thousands) that have been (laboriously) tagged in Finder. Now, I want to rescan many of the photos - is there any way to transfer Finder tags from the old files to the new ones without resetting them all, one by one? Please say yes!
 
I use this script to create another script which will apply tags to all files (in case they have lost them).

It does require the "tag" command. You get this with HomeBrew.

/usr/local/bin/tag -tf '*' > tag.txt
sort tag.txt > alltag.txt
# " -> \" Tags, tab, file Remove trailing spaces Echo file tag, Tags, space, "file"
sed -e 's/\"/\\\"/g' alltag.txt | awk -F"\t" '{ print $2 "\t" $1}' | sed -e's/[[:space:]]*$//' | awk -F"\t" '{print "echo \"" $2 "\" ; " "tag -s " $1 " \"" $2"\""}' > alltagset.sh
chmod +x alltagset.sh
The comment is supposed to line up with the various bits in the sed and awk line!! That line just mucks about with the alltag.txt so can't hurt your system whilst you debug it.

You can change the first line to restrict to just the folder with the old photos.

You can either modify alltagset.sh to refer to the new files (I assume the same names) or rename folders so the the new photos are in the same place as the old ones were originally.

I don't blame you if you prefer a nice gui app, but in that case I can't help you :(
 
Last edited:
  • Like
Reactions: Brian33
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.