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

Understanding a Create Folder Terminal Command

Good morning Apple users,


An ex-colleague of ours created a Terminal command for our workplace that generates multiple blank folders for work documentation to be saved into per the "job number/folder number". i.e Job Number 17813 would go into the folder of the same number.


For obvious reasons we would prefer to avoid having to manually generate such folders.


He left the script with us but we are having trouble understanding it's use to generate new folders with the same structure. I'm hoping someone could break it down for me and help me understand how it works?


I've attached the script as it's written for you to dissect.


User uploaded file


The above is the script within Text/Edit. When opening the file and attempting to do the requested "Please enter the thousands part of the SRO range: " in multiple combinations from "18000" to "18000 - 18999" and simply "18" it responds with the following message, Attached below:


User uploaded file


I'm sure our issue is something minor and we are just missing some tiny detail. Your assistance in getting this working is greatly appreciated!


Thanks in advance.

Posted on Apr 20, 2015 5:17 PM

Reply
Question marked as Best reply

Posted on Apr 20, 2015 6:36 PM

Remove 'OSX Raid' from the path in the fourth line.


(126428)

3 replies

Apr 20, 2015 6:35 PM in response to AaronLeigh123

I haven't run your script, but the relevant part seems to be the error message:


OSError: [Errno 2] No such file or directory: '/Volumes/OSX Raid/Service/Service Documentation/'


To me, this says that the target parent directory doesn't exist, and is likely failing on the line:


os.chdir(path)


since you can't change to a non-existent directory. The rest of the script is irrelevant at this point.


So you need to look at why this command might fail. The most obvious problem would be that it doesn't exist - maybe the volume isn't mounted, or the path doesn't match _exactly_. My python is rusty, but the spaces in the path may also be a problem (most shell commands barf at spaces in path names) - you might want to identify the path as a 'raw' string:


path = r'/Volumes/OSX Raid/Service/Service Documentation/'

(note the leading 'r')

Understanding a Create Folder Terminal Command

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