Add and remove multiple tags at once from a file or a folder

Using OS X Mavericks I want to add multiple tags at once to a file or a folder and I also want to remove multiple tags at once. There are different ways to add tags to a file, one of them would be to drag the file on top of the 'tag label' (image).

I want to set my 'File' to "In Progress" and "Important" at once using one combined label. Is it possible to add multiple tags at once using OS X Finder only? Maybe using folder-actions or smart-folders? Or maybe by a (unknown) 'copy tags from other file' option?

If no OS X Finder solution is possible, what would be a valid solution for this problem?

enter image description here


Solution 1:

Here's two commands that lets you copy tags from one file to another.

xattr -wx com.apple.metadata:_kMDItemUserTags \
"$(xattr -px com.apple.metadata:_kMDItemUserTags /path/to/original)" /path/to/copy
xattr -wx com.apple.FinderInfo \
"$(xattr -px com.apple.FinderInfo /path/to/original)" /path/to/copy

You can iterate through various files to copy the tags to multiple destinations. For applying the above to various files based on the results of a find command (which lets you automatically iterate through results of various searches), see my answer here:

  • How to tag files (with Finder tags) using parts of a file name?

Here is a small bash script using the previously mentioned commands. You can use it, for example, in Automator.

#!/bin/bash
# copy Tags from 1 file folder to the next

TAGS_FROM="$1"
TAGS_TO="$2"

if [[ -e "$TAGS_FROM" ]] && [[ -e "$TAGS_TO" ]]; then
  xattr -wx com.apple.metadata:_kMDItemUserTags "$(xattr -px com.apple.metadata:_kMDItemUserTags "$TAGS_FROM")" "$TAGS_TO"
  xattr -wx com.apple.FinderInfo "$(xattr -px com.apple.FinderInfo "$TAGS_FROM")" "$TAGS_TO"
else
  echo "Unexpected input, usage:"
  echo "$(basename "$0") /path/to/original /path/to/copy"
  exit 1
fi

Here is an example of an automator/apple-script (still using the bash commandline...). First set some attributes for this automator.app, then drag a file onto the app. The file will then copy the attributes from the automator.app to itself. I am no Applescripter, so improvement is always welcome.

attributes through applescript

Solution 2:

You can add multiple tags at once using OS X Finder only by selecting a file/folder while clicking the Edit Tags Finder Bar Icon to assign multiple tags to it at once:

enter image description here

Alternatively, simply right click (or Control + click) the file/folder to add or remove tags with ease.

/I could be misunderstanding your question.