Jump to content

How to execute a terminal command for each of the selected files in Finder?


Recommended Posts

I am working on a workflow which should execute a shell script command for of the documents (*.xml files) currently selected in the Finder.

 

I did some experiments around it, but could not get it to work yet. Any pointers, e.g. what workflow elements I will need?

I am currently thinking along the lines of first calling an applescript which gives me the selected files, then filtering out only the xml files and lastly calling a shell script for each of the files or alternatively calling the script once but passing along an array of xml files.

 

What do you guys think?

 

Thanks for any suggestions / sample workflows.

Edited by davosian
Link to comment

I am working on a workflow which should execute a shell script command for of the documents (*.xml files) currently selected in the Finder.

 

I did some experiments around it, but could not get it to work yet. Any pointers, e.g. what workflow elements I will need?

I am currently thinking along the lines of first calling an applescript which gives me the selected files, then filtering out only the xml files and lastly calling a shell script for each of the files or alternatively calling the script once but passing along an array of xml files.

 

What do you guys think?

 

Thanks for any suggestions / sample workflows.

 

If you use File Actions you wouldn't have to write your own AppleScript to do that. You could simply press Cmd+Opt+\ and select your action to run. That would pass a tab delimited list of selected files into the workflow. Then you would only need to split it up using the delimiter and run through a loop to hit every file

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...