Question

How can I remove Finder tags from all files in a given folder and in its subfolders?

Was it helpful?

Solution

You can use Homebrew's tag:

brew install tag
tag -r /path/*

You can combine this with a find command to find specific files/folders + recursive.

find . -exec tag -r {} \;  -print

OTHER TIPS

You can also use xattr:

xattr -dr com.apple.metadata:_kMDItemUserTags ~/folder
xattr -dr com.apple.FinderInfo ~/folder

If you don't delete the com.apple.FinderInfo extended attributes, Finder keeps showing the color labels for tags with colors. If you don't want to keep any extended attributes, you can just run xattr -cr ~/folder.

You can use find -xattrname or mdfind to find files with tags:

find ~/folder -xattrname com.apple.metadata:_kMDItemUserTags
mdfind -onlyin ~/folder kMDItemUserTags=\*
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top