Duplicate folders to a newly made folder name made from variables.

Hi Its probably something simple… It always is… :slight_smile:
but its been bugging me for a bit now…
I know how to copy from one folder to another…

But I’m trying to copy the contents from a static folder on a mounted drive (that part works)
to a newly created folder made from lots of specified variables. The folder now exists on the drive with the variable of ‘LiveProjects_Area_ProjectFolder’ with the location ‘LiveProjects_AreaClient’ variable.

How do i duplicate the folders from LIVE PROJECTS:TEST:Template:CS to the newly made folder ‘LiveProjects_Area_ProjectFolder’ at the location ‘LiveProjects_AreaClient’

This is just part of the script but I’m sure you know what i mean…

Thanks for any help…

Rob



try
			duplicate folders of folder "LIVE PROJECTS:TEST:Template:CS:" 
			to LiveProjects_Area_ProjectFolder at LiveProjects_AreaClient
			error errMsg number errNum
			display dialog "Error: " & errNum & return & errMsg
		end try
	

Can you please post the bit of code which creates that folder?

Sure hope this helps a bit more… this is whats set before the duplication… without the error handlers etc…

The ‘Input_DivCode’, ‘CS_Area_ProjectFolder’, ‘Input_ProjNumber’ etc are all user specified variables from further up the script.

Hope this sheds some light on the problem.

Thanks Rob

mount volume "afp://IP address/Client Services/"
			choose folder with prompt "(In the following dialogue box, Highlight the folder and click Choose)" default location "/Volumes/Client Services"
			
			set CS_Area_ClientFolder to result

set CS_Area_ProjectFolder to (Input_DivCode & "_" & "CS" & "_" & Input_ProjNumber & "¢" & Input_JobNumber & "_" & Input_JobTitle)
make new folder with properties {name:CS_Area_ProjectFolder} at CS_Area_ClientFolder

When making folders etc the script should talk to Finder.
Change this:

make new folder with properties {name:CS_Area_ProjectFolder} at CS_Area_ClientFolder

to this:

tell application "Finder"
	set targetFolder to make new folder with properties {name:CS_Area_ProjectFolder} at CS_Area_ClientFolder
end tell

Change the try block like so:

try
	tell application "Finder"
		duplicate folders of folder "LIVE PROJECTS:TEST:Template:CS:" to targetFolder
	end tell
	error errMsg number errNum
	display dialog "Error: " & errNum & return & errMsg
end try

If it still doesn’t work please post the entire script, and any error messages you get.

Minor comment alastor, you forgot the ‘on’ before error errMsg number errNum

I was right was something simple!!

Thanks very much alastor933 i have added the changes to my script and it works wonderfully.

DJ Bazzie Wazzie, I mistakenly missed the ‘on’ when pasting question on the script.

Thanks

Rob

That try block compiles notwithstanding the syntax error.
There’s a pitfall for you…