Jump to content
Sign in to follow this  
davosian

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

Share this post


Link to post

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

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  
×
×
  • Create New...