Jump to content

Run terminal commands with current finder folder


Recommended Posts

Hello so currently I am using this LeEnno's terminalfinder workflow

to get the current finder folder and open in terminal to run some commands for files in the folder. I want to streamline this and and not have to type in stuff in the terminal. How can I run a terminal command for the current finder folder opened?

Edited by canonlp
Link to comment

I'll get you a workflow to do this ASAP :)

 

And wow, that was much easier that I thought, I google for the quick AppleScript to grab the current Finder window path and get a script that does EXACTLY what we were looking for ha.

 

So, create a workflow, add a Keyword (set details and all), add a Run Script item (set language to /usr/bin/osascript, untick the Escape Spaces option) and paste in this..

tell application "Finder" to set currentDir to (target of front Finder window) as text
do shell script "cd " & (quoted form of POSIX path of currentDir) & "; {query}"

Tested using a keyword "term" to create a new folder in the current Finder window. Works just as expected.

Link to comment

Thanks David,

 

I don't know where I can put my commands, the commands I need to execute are

 

unrar x somerarfile.rar

 

Download this workflow. Open the Finder path that you want to run the command in and press Cmd+Space (or whatever your Alfred hotkey is), type 'term <command>' where <command> would be replaced by whatever command you want to run. In the example you provided.. You would type..

term unbar x somerarfile.rar
Link to comment
  • 4 years later...
On 11/5/2013 at 3:00 AM, jdfwarrior said:

 

Download this workflow. Open the Finder path that you want to run the command in and press Cmd+Space (or whatever your Alfred hotkey is), type 'term <command>' where <command> would be replaced by whatever command you want to run. In the example you provided.. You would type..


term unbar x somerarfile.rar

 

Can you reshare? :)

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...