Recursively tag files in a folder

I want to select a number of files and tag them say "Purple". However, these files exist in a complex directory structure, and it would be much easier to tag the parent folders and then run an automator routine or applescript to tag the child files. Something like:

tell application "Finder"
		set theselection to selection
		repeat with anitem in theselection
			if kind of anitem is "Folder" then
				tell application "Finder" to get items of anitem
				repeat with eachfile in anitem
					set thisFile to eachfile
                    set newTag to {"Purple"}
                    set the tags of eachfile to tags eachfile & newtag					
				end repeat
			end if
		end repeat
	end tell
end run


Clearly the line" set the tags of eachfile to tags eachfile & newtag" is madeup, but could i set it so that it worked?


Any suggestions gratefully received, or I will be spending a lot of time (and mistakes) in diving down to tag files

Mac mini, macOS 13.5

Posted on Sep 11, 2023 5:59 AM

Reply
3 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Recursively tag files in a folder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.