canonlp Posted November 3, 2013 Share Posted November 3, 2013 (edited) 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 November 3, 2013 by canonlp Link to comment
jdfwarrior Posted November 4, 2013 Share Posted November 4, 2013 I'll get you a workflow to do this ASAP Link to comment
jdfwarrior Posted November 4, 2013 Share Posted November 4, 2013 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
canonlp Posted November 4, 2013 Author Share Posted November 4, 2013 (edited) Thanks David, I don't know where I can put my commands, the commands I need to execute are unrar x somerarfile.rar Edited November 4, 2013 by canonlp Link to comment
jdfwarrior Posted November 5, 2013 Share Posted November 5, 2013 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
gandalfsaxe Posted February 1, 2018 Share Posted February 1, 2018 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
gandalfsaxe Posted February 1, 2018 Share Posted February 1, 2018 I think I got it to work.. somewhat. I can delete a file using e.g. "term rm img1.jpg", however I cannot get it to run a Makefile in the folder, i.e. using "term make". Any suggestions? Link to comment
deanishe Posted February 1, 2018 Share Posted February 1, 2018 Alfred doesn't use your shell environment. Might be due to that. What does the debugger say? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now