I have created an Automator application that will create a new folder for a Project with subfolders with the help of a Shell Script. The application starts by asking for a Project Name and a Location (directory) and once it is created it opens the newly created project folder.
eg:
Up to that point it works as intended, however I am also trying to add some files to the subfolders automatically but I'm stuck and I haven't been able to find the solution on my own.
Basically I am trying to copy the files from another folder into one of the newly created subfolders but I'm getting (mostly) the following two errors:
The action “Run Shell Script” encountered an error: “usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory” usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
The action “Run Shell Script” encountered an error: “cp: /path/to/sourcefile/file.pdf: No such file or directory”
This is what I have:
mkdir "$1/$2"
mkdir "$1/$2/Guides_and_Bulletins"
mkdir "$1/$2/Pictures"
mkdir "$1/$2/Schematics"
mkdir "$1/$2/Schematics/Calculator"
mkdir "$1/$2/Schematics/As_built"
mkdir "$1/$2/Site_Docs"
cp "/path/to/sourcefile/file.pdf" "/$1/$2/Guides_and_Bulletins/file.pdf"
In that example I am trying to copy the file.pdf from one location to the newly created Guides_and_Bulletins subfolder from the actions above but of course it is not working.
Any help will be greatly appreciated! Thank you
Note: I of course am changing the path for cp "/path/to/sourcefile/file.pdf" "$1/$2/Guides_and_Bulletins/" to the correct one