This question already has an answer here:
I want to create an Automator Service that will run an xattr Terminal command on a single or batch of files.
I can do the operation in Terminal (kinda), but I didn't understand how to apply that to Automator.
Basically I was trying to remove
Where From extended attributes from an flv or mp4 file. In terminal I'd simply type:
xattr -d com.apple.metadata:kMDItemWhereFroms /Path/To/File
That threw an error, but it still worked.
I'm running macOS 10.11.6, El Cap.
I finally figured it out. It appears I didn't need to be as selective with the xattr command, since I just want to clear all the extended attributes. Here's an image of what appears to work:
I still don't entirely understand the actual Shell Script language. I learned from reading a lot of other posts that unlike Terminal, you have to tell the shell script where xattr (the tool) is.
I assume that "$f" is the file(s) that you select in the Finder.
I continue to be confused by the difference between "Get Selected Finder Items" & Get Specified Finder Items." They both seem to pass whatever you choose in the Finder through. I chose the 1st option and it worked.
Apologies if this all seems elementary to you guys, I have zero experience writing scripts. I just usually cut and paste someone else's work, and 9 times out of 10 that's done the job. Just couldn't find this particular explanation anywhere. Hopefully it will help someone else.