Duplicating Folders

Hi All,

Can anyone tell me why this script throws an error that it can’t duplicate itself?..I know this is probably something very simple that I’m missing but can’t figure it out.


set destination to (path to library folder from user domain as text) & "Application Support"
tell application "System Events"
	set checkFolder to (destination & ":Flo Tools" as text)
	if not (exists folder checkFolder) then
		tell application "Finder"
			duplicate folder views to folder destination
		end tell
	else
		display alert "FloTools Plug-In Views already exist." message "FloTools has detected that you already have Plug-In Views installed. Flo Tools will now make a backup of your Plug-In Views, and store them in the Flo Tools directory of Application Support. The folder will then be overwritten with updated Plug-In Views from the installer. To restore user-created Plug-In Views, please copy the necessary text files from the backup." as informational buttons {"Continue"} default button "Continue"
		set timeStamp to do shell script "(date '+%m-%d-%Y, %I:%M:%S%p')"
		tell application "Finder"
			set folderName to "Backup of Plugin Views" & space & timeStamp
			set BackupSource to (checkFolder & ":Plug-In Views" as text)
			make new folder at checkFolder with properties {name:folderName}
			duplicate folder BackupSource to folder folderName
		end tell
	end if
end tell


Thanks so much,

Rocco

Hi,

folderName is just a folder name, a string. Without any further reference the Finder treats it as a subfolder of the desktop folder.

You probably mean:

set backupFolder to make new folder at folder checkFolder with properties {name:folderName}
duplicate folder BackupSource to backupFolder

Yes, that’s exactly what I meant. Thank you so much!