jdberry / tag

A command line tool to manipulate tags on Mac OS X files, and to query for files with those tags.
MIT License
1.47k stars 94 forks source link

Tag setting not properly working #20

Closed mainrs closed 8 years ago

mainrs commented 8 years ago

Hey there,

I try to do some stuff with iTunes and your tag command line. I have the following written in Applescript:

do shell script "/usr/local/bin/tag --set 'Electro House' '~/Music/iTunes/iTunes Media/Music/Alex Skrindo/Moments/Moments (feat. Stahl!).mp3'"

The tag should be "Electro House" and the file does exist at the specific location, I already checked that. But the problem is that if I type it right into the command line it works but if I call it like in the code snippet above, I always get following error message:

tag: The operation couldn’t be completed. (OSStatus error -43.)

As far as I am aware of the error code 43 has something to do with the existence of the file. But those files to all exist. Maybe you have a clue. Obviously the command itself works but not if I call it through Applescript even if they both are technically the same...

EDIT: The above command does not work in the terminal. Just tags without spaces do work for me...

jdberry commented 8 years ago

Note that you've quoted the filename with single quotes, which means that the tilda won't be evaluated by the shell. And tag itself doesn't attempt to evaluate such shell patterns. Thus you are receiving a -43 error, which means file not found. Compare doing ls ~ vs ls '~'.