How do you create a hierarchy of folders and sub folders?

I am very new to AppleScript, really stuck and badly need some help. How do you create a hierarchy of folders and sub folders with only some of the folders changing there name?

I want a folder to be created in the most front open window with a variable name, then within this folder a number of folders (some with variable names) and then within some of these folders other folders e.g.

• Folder A
to be renamed by the user via a dialog box.

Within Folder A:
• Folder B
• Folder C
• Folder D
• Folder E
Folder B and C’s name needs to be changed with the same prefix (e.g. “1234 Folder B” and “1234 Folder C” where 1234 is a number decided by the user, asked in a dialog box). The other Folders just need to be created with a known name.

Within Folder B:
• Folder F
• Folder G
always the same names.

I need to create this folder hierarchy so at work we can always have the same set of folders created for each new job.

I would really appreciate any help given!

Much thanks.

I have had this laying around and it is quite handy:

So, putting it all together:

Jon

Thank you to both of you for your help. I have managed to figure most of what I need from your posts and other scripts that I’ve been looking at. The script has changed from the initial idea so I have included it to show how far I have got.

try
	tell application "Finder" to set the source_folder to (folder of the front window) as alias
on error -- no open folder windows 
	set the source_folder to path to desktop folder as alias
end try

tell application "Finder"
	set jobNumber to text returned of (display dialog "What is the job number?" default answer "1234")
	set jobPhase to text returned of (display dialog "What is the job phase?" default answer "001")
	set jobName to text returned of (display dialog "What is the job name?" default answer "")
	set jobStuff to jobNumber & " Stuff"
	set wholeJobName to jobNumber & "." & jobPhase & " " & jobName --This folder needs to have a limit of 32 characters
	set artworkFolder to jobNumber & "." & jobPhase & " ARTWORK"
	set visualFolder to jobNumber & "." & jobPhase & "  VISUALS"
	set imagesFolder to "Images"
	set copyFolder to "Supplied Copy"
	set oldDocFolder to "Old Documents"
	set pdfFolder to "PDFs"
	set hiresFolder to "HIRES"
	set loresFolder to "LORES"
	set supplyImagesFolder to "Supplied Images"
	
	make new folder at source_folder with properties {name:(jobStuff)} --main job folder

--the following folders need to be organised into a specific hierarchy indicated by the comments.
	
	make new folder at source_folder with properties {name:(wholeJobName)} --saved in the folder "jobStuff"
	
	make new folder at source_folder with properties {name:(artworkFolder)} --saved in the folder "wholeJobName"
	make new folder at source_folder with properties {name:(visualFolder)} --saved in the folder "wholeJobName"
	make new folder at source_folder with properties {name:(imagesFolder)} --saved in the folder "wholeJobName"
	make new folder at source_folder with properties {name:(copyFolder)} --saved in the folder "wholeJobName""
	
	make new folder at source_folder with properties {name:(oldDocFolder)} --saved in the folder "artworkFolder"
	make new folder at source_folder with properties {name:(pdfFolder)} --saved in the folder "artworkFolder"
	
	make new folder at source_folder with properties {name:(hiresFolder)} --saved in the folder "imagesFolder"
	make new folder at source_folder with properties {name:(loresFolder)} --saved in the folder "imagesFolder"
	make new folder at source_folder with properties {name:(supplyImagesFolder)} --saved in the folder "imagesFolder"
	
end tell

If you run the script you will see the idea behind it. I have left all the folders in the source_folder and not into there required folders as I’m not sure if the example scripts can help me or not? To be honest I’m not sure how to do it! (There are comments next to the folders to indicate where they need to go.)

I will be grateful for any more help,

Cheers
Tim

Um, it doesn’t look like you used anything from the posts above which would have solved all your problems. This was served to you on a silver platter allowing you to tweak it just a little bit to suit your needs but that didn’t happen. At least you’re appreciative… Here it is, the complete script:

See how easy that was compared to the original scripts above?

Jon

Jon you are a star! As you can imagine I needed help, badly! I can now examine how the script works without worrying if I’ve got all the bits in the right order.

Thanks again!