You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automator : How to add a specific file to an Automator folder structure every time

I have an Automator process that I have used for many years which creates a folder structure for me, all without issue.


Every time I run that, I then get an excel file from another location and put it inside one of the folders, but I assume I can automate that as well?


mkdir "$1/$2"

mkdir "$1/$2/Documents" <<<< I want a certain Excel file in here each time I run it.

mkdir "$1/$2/Documents/Factory"

mkdir "$1/$2/Documents/Freight"


Is it possible?


Thanks.

iMac 27″ 5K, macOS 13.3

Posted on May 3, 2023 10:41 PM

Reply
Question marked as Top-ranking reply

Posted on May 4, 2023 2:42 AM

Is that always the same excel file, from the same location?

Try the "Get Specified Finder Items" action. This can easily get that excel file into your Workflow.


Or just add the appropriate shell command to tou your shell script.


cp <path-to-file> <destination>


for example, it may be


cp ~/Documents/myexcelfile.xlsx "$1/$1/Documents"


Similar questions

4 replies
Question marked as Top-ranking reply

May 4, 2023 2:42 AM in response to simoncook1969

Is that always the same excel file, from the same location?

Try the "Get Specified Finder Items" action. This can easily get that excel file into your Workflow.


Or just add the appropriate shell command to tou your shell script.


cp <path-to-file> <destination>


for example, it may be


cp ~/Documents/myexcelfile.xlsx "$1/$1/Documents"


May 4, 2023 2:58 AM in response to Luis Sequeira1

Thank you.


Yes, it is the same file that I will to put in to that folder every time. I have tried the above and initially got a couple of error messages. I determined that is because the document was called "Costing Sheet" (my lack of knowledge on such matters!). Removing the space fixed the issue and it works perfectly, thank you very much!

May 4, 2023 3:43 AM in response to simoncook1969

Whenever you type commands in Terminal (or a shell script in your case), you have to be mindful of spaces, as they are used to separate things.

Therefore

Costing Sheet


is read as two separate words.

Renaming to avoid spaces is a good idea, as it can steer clear of a number of pitfalls; but in this case an easy solution is just to enclose in double quotes, e.g.


cp "~/Documents/Costing Sheet.xlsx" "$1/$2/Documents"


You may have noticed that already the arguments of your mkdir commands were enclosed in double quotes; this too is necessary, in case the paths to those folders have spaces in them.

Automator : How to add a specific file to an Automator folder structure every time

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.