make sub folders

hello

I have the following script…


set workFolderSubLlist to {{"Sub-1", {"Sub-1-1", "Sub-1-2", "Sub-1-3", "Sub-1-4", "Sub-1-5", "Sub-1-6"}}}
set newClientNameFolder to "My Client Folder"
--			
tell application "System Events"
	set Hard_Disk to name of (startup disk) as string
	set mypath to Hard_Disk & ":MyTestFolder" as string
	set thepath to mypath as alias
	--
	tell application "Finder"
		set baseFolder to make new folder at thepath with properties {name:newClientNameFolder}
		--
		repeat with i from 1 to count workFolderSubLlist
			try
				set {tier2, t2Subs} to {item 1, item 2's items} of item i of workFolderSubLlist
				set tier2Folder to make new folder at baseFolder with properties {name:(tier2), label index:2}
				repeat with tier3 in t2Subs
					make new folder at tier2Folder with properties {name:(tier3)}
				end repeat
			on error
				make new folder at baseFolder with properties {name:(item 1 of item i of workFolderSubLlist)}
			end try
		end repeat
		activate
	end tell
end tell

I want to add another tier of folders under “Sub-1-1” I tried changing my list to {{“Sub-1”, {“Sub-1-1”,{“Sub-1-1-1”, “Sub-1-1-2”} “Sub-1-2”, “Sub-1-3”, “Sub-1-4”, “Sub-1-5”, “Sub-1-6”}}}
but I’m stuck on referencing the new tier to create the folders.

Any help would be much appreciated

thanks

LJ

Hi,

easiest way


set workFolderSubLlist to "Sub-1/{Sub-1-1,Sub-1-2,Sub-1-3,Sub-1-4,Sub-1-5,Sub-1-6}"
-- set workFolderSubLlist to "Sub-1/{Sub-1-1/{Sub-1-1-1,Sub-1-1-2},Sub-1-2,Sub-1-3,Sub-1-4,Sub-1-5,Sub-1-6}"
set newClientNameFolder to "My Client Folder"
--	
do shell script "/bin/mkdir -p /'" & newClientNameFolder & "'/" & workFolderSubLlist

thanks Stefan

How would I reference the path to the existing folder where I want the new folders to be created?

set mypath to “G5 Macintosh HD:MyTestFolder” as string

thanks
LJ

the value of newClientNameFolder is the base folder,
the leading slash is the startup volume.

In the script the folders will be created with this hierarchy

/'My Client Folder'/Sub-1/{Sub-1-1,Sub-1-2,Sub-1-3,Sub-1-4,Sub-1-5,Sub-1-6}"

to include MyTestFolder use this line


.
do shell script "/bin/mkdir -p /MyTestFolder/'" & newClientNameFolder & "'/" & workFolderSubLlist
.

You might also be interested in subidoo, a script that creates folder structures using the technique described by StefanK :slight_smile:

I originally wrote it to create client folders for an electroplating business I worked for.

Best regards from sunny Berlin!

Thanks for all your help guys, I think I’m getting somewhere now, I’ll have a look at subidoo in my lunch hour - need to to some paying work now!

ok, so I’ve got everything working, when my base folder (MyTestFolder) is located on my hard drive…


set newName to "ClientNameFolder"
			--these are the Client Resources Sub Folders
			set workFolderSubLlist to "/'MyTestFolder'/" & "'" & newName & "'" & "/Client-Resources/{Elements/{Maps,Templates},Gallery,General-Info,Image-Library,Images-to-Sort/{Image-Dump,Images-to-Code},Logos/{Support-Logo,Main-Logos}}"
			--
			do shell script "/bin/mkdir -p /'" & "'/" & workFolderSubLlist

However, I need to make all these folders on our server?

I have a sharepoint called “Studio” that i need to get to, I’ve found a script to mount them but dont know how to include them in the path.

thanks

LJ

A shared drive is located in /Volumes, the path starts with /Volumes/Studio/

Note: If you include the whole parameter string in the variable workFolderSubLlist, this is sufficient


do shell script "/bin/mkdir -p " & workFolderSubLlist