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 3:43 AM

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.

Similar questions

4 replies
Question marked as Top-ranking reply

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.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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.