Add name and number to subfolders

Hello,

I believe I got most of the following script from StefanK. It was a few hours ago and have been looking at Applescript since then. I believe it was ‘create job folders’ tag

I can create my main folder. I tried to set a variable (tempName) to add to the subfolder names (files & renders)

Any thoughts anyone?



set jobName to text returned of (display dialog "Enter factory name:" default answer "")
set jobNum to text returned of (display dialog "Enter a batch number:" default answer "")
set tempName to jobName & jobNum

set folderpath to POSIX path of (choose folder with prompt "Select client folder")

do shell script "/bin/mkdir -p " & quoted form of folderpath & "/" & ¬
	quoted form of (jobName & " " & jobNum) & "/ {Files,Renders,}"


Thanks . Randy

Model: Mac Pro 1,1
AppleScript: 2.2.1
Browser: Safari 537.31
Operating System: Mac OS X (10.8)

Try:

do shell script "/bin/mkdir -p " & quoted form of folderpath & "/" & ¬
	quoted form of (jobName & " " & jobNum) & "/{\"Files\",\"Renders\"}"

Hi adayzdone,

Thanks but that doesn’t do anything. My original file adds the subfolders Files & Renders.

I am trying to work with variables, but sometimes get errors. I haven’t had time to work on it today.

Here is some variables in the script


set jobName to text returned of (display dialog "Enter factory name:" default answer "")
	set jobNum to text returned of (display dialog "Enter a batch number:" default answer "")
	set tempName to (jobName & " " & jobNum)
	set folder1 to "Files"
	set name1 to (tempName & " " & folder1)
	set name2 to (tempName & " " & "Renders")
	
	set folderpath to POSIX path of (choose folder with prompt "Select client folder")
	
	do shell script "/bin/mkdir -p  " & quoted form of folderpath & "/" & ¬
		quoted form of (jobName & " " & jobNum) & "/{Files,Renders}"

I have tried these to no avail . expected expression but found end of line. with the next try.


do shell script "/bin/mkdir -p  " & quoted form of folderpath & "/" & ¬
		quoted form of (jobName & " " & jobNum) & "/" & quoted form of folder1 &

I got this to work for one subfolder, working on adding second variable ‘name2’


set jobName to text returned of (display dialog "Enter factory name:" default answer "")
set jobNum to text returned of (display dialog "Enter a batch number:" default answer "")
set tempName to (jobName & " " & jobNum)
set name1 to (tempName & " " & "Files")
set name2 to (tempName & " " & "Renders")

set folderpath to POSIX path of (choose folder with prompt "Select client folder")

do shell script "/bin/mkdir -p  " & quoted form of folderpath & "/" & ¬
	quoted form of (jobName & " " & jobNum) & "/" & quoted form of name1 & ""

Thanks Adayzdone

Special thanks to StefanK, been looking at some help he has been giving other people.

Hi.

Is this what you’re tying to do?


set jobName to text returned of (display dialog "Enter factory name:" default answer "")
set jobNum to text returned of (display dialog "Enter a batch number:" default answer "")
set tempName to (jobName & " " & jobNum)

set folderPath to POSIX path of (choose folder with prompt "Select client folder")

do shell script "/bin/mkdir -p  " & quoted form of (folderPath & "/" & ¬
	tempName & "/" & tempName & " ") & "{Files,Renders}"

Thanks Nigel,

yes exactly.

So - quoted form of a variable as opposed to plain Jane variable - ?

so using folderpath bracketed with main folder & subfolder variables, then adding the subfolder ‘suffixes’ . cool.

I had just arrived at this, see below, but I was getting two folders of jobName jobNum “Files”


set jobName to text returned of (display dialog "Enter factory name:" default answer "")
set jobNum to text returned of (display dialog "Enter a batch number:" default answer "")
set tempName to (jobName & " " & jobNum)
set name1 to (tempName & " " & "Files")
set name2 to (tempName & " " & "Renders")

set folderpath to POSIX path of (choose folder with prompt "Select client folder")

do shell script "/bin/mkdir -p  " & quoted form of folderpath & "/" & ¬
	quoted form of tempName & "/{" & quoted form of tempName & "_Files," & quoted form of tempName & "_Renders}/"

Cheers,
Randy