winterflags Posted June 14, 2016 Share Posted June 14, 2016 (edited) Based on a File Filter, I want to go to two locations with Terminal, within the same Workflow. Let's say the file filter path result is: ~/my/folder. The first part of the workflow will simply go to cd {query} which navigates to ~/my/folder. In the next part of the workflow, I want to keep the last part of the query – "folder" – i.e. the "Display Name" in the File Filter, and interject it in the path ~/my/other/folder. I guess there might be multiple ways to achieve this, and the way I've been trying to figure out has been to modify the query via string replacements, so that ~/my/ becomes ~/my/other/ I have also tried to understand upstream variables and if it's possible to get the "Display Name" in the File Filter and simply take that variable and paste it into the path ~/my/other/ so that it becomes ~/my/other/{var} i.e. ~/my/other/folder, but I haven't succeeded. Appreciate any help with this since I've spent almost an hour now with no results! Edited June 14, 2016 by winterflags Link to comment
deanishe Posted June 14, 2016 Share Posted June 14, 2016 Use the shell command basename: basename ~/my/folder # -> folder So your alternative might look like: query="{query}" name="$( basename "$query" )" echo "~/my/other/$name" (echo sends the output to the next workflow action.) Link to comment
winterflags Posted June 14, 2016 Author Share Posted June 14, 2016 (edited) Hi @deanishe, thanks for your help! I'm not sure if I'm quite getting how to do this in practice. Also, I'm not sure how to get the echo to work with the whole Terminal Command (it also does other stuff). I've added some images just to make it more clear what I'm attempting: Terminal Command: (The last image is obviously not going to work with the echo, as it stands). Edited June 14, 2016 by winterflags Link to comment
deanishe Posted June 14, 2016 Share Posted June 14, 2016 (edited) Here's an example workflow that demonstrates building a different path from {query}. That might be helpful, but I'm not really sure what it is you're trying to achieve. Edited June 14, 2016 by deanishe Link to comment
winterflags Posted June 14, 2016 Author Share Posted June 14, 2016 (edited) Thanks for supplying the demo! It did what I wanted to achieve. Edited June 14, 2016 by winterflags 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