Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Traverse

macrumors 604
Original poster
Mar 11, 2013
7,727
4,517
Here
I used to use this automator right click menu for all kinds of services. It allowed me to save a file or folder to another location (replace any existing version) and stripped meta data like tags from the file.

After upgrading to 10.9.4 this code is no longer removing tag data. Is there something wrong with it or does 10.9.4 remove xattr utility?



Code:
for FILE in "$@";do
	FILE_NAME="${FILE##*/}"
	if [ -d "$FILE" ]; then 
		rsync -rut "$FILE"/ /tmp/"$FILE_NAME"
		xattr -rc /tmp/"$FILE_NAME"
		rsync -rut /tmp/"$FILE_NAME"/ ~/Dropbox/"$FILE_NAME"
		rm -r /tmp/"$FILE_NAME"/
	else
 		rsync -ut "$FILE" /tmp/"$FILE_NAME"
		xattr -c /tmp/"$FILE_NAME"
		rsync -ut /tmp/"$FILE_NAME" ~/Dropbox/"$FILE_NAME"
		rm /tmp/"$FILE_NAME"
	fi
done
 
Well you should probably just run it as a bash script and see what error it gives you.

xattr still works so it's likely you're experiencing another issue.
 
Well you should probably just run it as a bash script and see what error it gives you.

xattr still works so it's likely you're experiencing another issue.

Could you explain how to do that?
 
Could you explain how to do that?

Make a new file
Change extension to .command
Open in textedit
Copy and paste code
Save file
Open terminal
Drag file into terminal
Drag item you want to pass as input into terminal
Press return

You can also just run the code in automator by changing it to take a specific file/folder as input.
 
Make a new file
Change extension to .command
Open in textedit
Copy and paste code
Save file
Open terminal
Drag file into terminal
Drag item you want to pass as input into terminal
Press return

You can also just run the code in automator by changing it to take a specific file/folder as input.

I created a text edit file with the code. Changed the extension to .command and dragged the command and then a folder to the terminal and it says "Permission Denied" after pressing enter.
 
Then you probably need exec privileges using chmod.

Chmod 755
Drag in bash file
Press enter

Drag in bash file
Drag in test file
Press enter
 
Then you probably need exec privileges using chmod.

Chmod 755
Drag in bash file
Press enter

Drag in bash file
Drag in test file
Press enter

Denied.

After I pressed enter the first time it gave me this:
 

Attachments

  • Screen Shot 2014-07-05 at 7.18.34 PM.png
    Screen Shot 2014-07-05 at 7.18.34 PM.png
    34.2 KB · Views: 136
needs to be a space after 755

eg

chmod 755 ~/Desktop/scripts/mem not chmod 755~/Desktop/scripts/mem

Okay. I added the space and followed your instructions. The first enter just went to a new terminal command.

Then I dragged the bash (shell) file and then the test folder and got this after the second enter:
 

Attachments

  • Screen Shot 2014-07-05 at 8.46.58 PM.png
    Screen Shot 2014-07-05 at 8.46.58 PM.png
    122.8 KB · Views: 127
For starters it looks like you probably used rich text document. You need to make sure it's plain text otherwise there's hidden formatting.

Secondly a possible problem could be that potentially your quotation marks got auto formatted (probably just in textedit but maybe in automator as well) and thus wouldn't work. Make sure your quotes have not been made into smart quotes. All quotes should be " not like ” or ‟ or 〞.
 
For starters it looks like you probably used rich text document. You need to make sure it's plain text otherwise there's hidden formatting.

Secondly a possible problem could be that potentially your quotation marks got auto formatted (probably just in textedit but maybe in automator as well) and thus wouldn't work. Make sure your quotes have not been made into smart quotes. All quotes should be " not like ” or ‟ or 〞.

Thank you for all your help. I created a .txt file and followed all instructions. And I check the quotes. I no longer get a permissions denoted, this is the only error I get now.

Something is wrong with the syntax of the code, what bothers me is I haven't touched this automator code since 10.8.2 and it worked through 10.9.3 until I got a new computer and remade the script using a copied version identical to the original code.
 

Attachments

  • Screen Shot 2014-07-06 at 1.14.56 AM.png
    Screen Shot 2014-07-06 at 1.14.56 AM.png
    17.9 KB · Views: 130
For starters it looks like you probably used rich text document. You need to make sure it's plain text otherwise there's hidden formatting.

Secondly a possible problem could be that potentially your quotation marks got auto formatted (probably just in textedit but maybe in automator as well) and thus wouldn't work. Make sure your quotes have not been made into smart quotes. All quotes should be " not like ” or ‟ or 〞.

I'm sorry to repost, but you've helped me so much and I wanted to ask one last thing.

You're right, I was using a rich text document. After using chmod and the shell file the process works (and removes the tags) when I do it via terminal. Do you have any idea why it's not working as a service via an automator right click menu?

It's the identical script copied and pasted from the automator service into the .command file. If I drag the command file and then any file or folder into the terminal it runs perfectly. But when done via automator it doesn't remove tags.

Automator says "Pass input: to stdin" if that means anything.
 
Last edited:
I'm sorry to repost, but you've helped me so much and I wanted to ask one last thing.

You're right, I was using a rich text document. After using chmod and the shell file the process works (and removes the tags) when I do it via terminal. Do you have any idea why it's not working as a service via an automator right click menu?

It's the identical script copied and pasted from the automator service into the .command file. If I drag the command file and then any file or folder into the terminal it runs perfectly. But when done via automator it doesn't remove tags.

Automator says "Pass input: to stdin" if that means anything.

Pass input needs to be set to "as arguments" not "to stdin"
 

Attachments

  • Screen Shot 2014-08-27 at 7.53.05 PM.png
    Screen Shot 2014-08-27 at 7.53.05 PM.png
    191.2 KB · Views: 140
Deleted.
 

Attachments

  • Screen Shot 2014-08-27 at 11.05.47 PM.png
    Screen Shot 2014-08-27 at 11.05.47 PM.png
    152.4 KB · Views: 138
Last edited:
Pass input needs to be set to "as arguments" not "to stdin"

It works! I removed the initial "Copy" action and just ran the shell script from automator and it's finally working again. I also edited the "do" to match your screenshot.

I just want to thank you so much for helping me and using your time. You don't know how much my workflow has been messed up by loosing this. Thank you so much, I know it was annoying. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.