I am using Mac OSX 10.8.3.
I have a workflow in Automator set up that is as follows:
The purpose of the workflow is to automate renaming a bunch of photos that I have saved in folders then move them to an new folder.
I want to grab the foldername and stick it in a variable and use that variable in the "new name box" in the Make Sequential section of the work flow (see attached) image.
How do I grab just the folder name and assign it to a variable. My example has a variable called "FolderName"
Here is a screenshot
This works in testing:
Get Value of Variable - set the Variable it obtains the value of to path
5a. set action 5 to ignore input from the above action 4 - Ctrl + mouse click on the action Title to get the Contextual Menu
Get Folder Contents - get the contents of the folder at the path passed on from Action 5
You can add your Move actions after as you wish.
You can use a Run Shell Script Action
, with the following code:
echo ${1##*/}
and Pass input:
set to as arguments
.
This will filter the passed input, giving only the file basename as output.
You should put this step before the action that sets FolderName
variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With