5

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

2

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:

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

|improve this answer|||||
  • 1
    What an effort you did to answer my question! I tested both your commands. The first one works like you would expect, for files and directories (Finder does not always update the dots in the filename, but the tag is there). Unfortunately the second example does not really work, it copies only 1 and copies only the 'color' but 'name' of the tag gets lost. ('Get Info' on the file shows what I mean). – CousinCocaine May 21 '14 at 15:21
  • 1
    @CousinCocaine Both commands should be used at the same time on the files :) The first one copies the tag metadata; the second one copies the colour and some backwards compatibility things for version of OS X before Mavericks that doesn't have custom tag names and just has the colours (and is also used for those dots). – grg May 21 '14 at 15:23
  • 1
    Got it. I made myself a small cpTags script to speed things up. – CousinCocaine May 21 '14 at 15:41
1

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.

|improve this answer|||||
  • 1
    How do you prevent the menu which opens on right-click to close after you've selected the first tag? – nohillside May 21 '14 at 9:15
  • 1
    @patrix Ah, that makes it clearer. Thanks. AFAIK, no built in shortcut. However, the "Edit Tags" icon in the finder's menu bar does not automatically close once you add a single tag. – njboot May 21 '14 at 9:20
  • 1
    I want to add multiple tags at once to a file or a folder, so no ctrl-click-ing multiple times. – CousinCocaine May 21 '14 at 11:11
  • 1
    @CousinCocaine Yes. So read the first part of my answer. No control clicking involved. Hit the "Edit Tags" button with a file/folder selected, and add multiple tags to it at once - as shown in the screenshot. – njboot May 21 '14 at 14:33
  • 1
    I see it works fine, but this was not my question. Sorry. – CousinCocaine May 21 '14 at 15:37

You must log in to answer this question.

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