10.9.4 Broke Xattr Code.

Discussion in 'OS X Mavericks (10.9)' started by Traverse, Jul 5, 2014.

  1. Traverse macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #1
    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
     
  2. w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
    #2
    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.
     
  3. Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #3
    Could you explain how to do that?
     
  4. w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
    #4
    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.
     
  5. Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #5
    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.
     
  6. w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
    #6
    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
     
  7. Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #7
    Denied.

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

    Attached Files:

  8. w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
    #8
    needs to be a space after 755

    eg

    chmod 755 ~/Desktop/scripts/mem not chmod 755~/Desktop/scripts/mem
     
  9. Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #9
    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:
     

    Attached Files:

  10. w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
    #10
    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 〞.
     
  11. Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #11
    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.
     

    Attached Files:

  12. Traverse, Aug 27, 2014
    Last edited: Aug 27, 2014

    Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #12
    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.
     
  13. w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
    #13
    Pass input needs to be set to "as arguments" not "to stdin"
     

    Attached Files:

  14. Traverse, Aug 27, 2014
    Last edited: Aug 27, 2014

    Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
  15. Traverse, Aug 27, 2014
    Last edited: Aug 27, 2014

    Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
  16. Traverse thread starter macrumors 603

    Traverse

    Joined:
    Mar 11, 2013
    Location:
    Here
    #16
    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. :)
     

Share This Page