Finder.app: Backup Selection to folder "Backups folder" of desktop


on backupFinderSelectionToDesktop()
	try
		tell application "Finder" to make new folder at desktop with properties {name:"Backups folder"}
	end try
	set targetFolder to "" & (path to desktop) & "Backups folder:"
	set _date to do shell script "date \"+%Y-%m-%d\""
	try
		tell application "Finder" to set targetFolder to make new folder at folder targetFolder with properties {name:_date}
	on error
		set i to 2
		repeat
			try
				alias (targetFolder & _date & " (" & i & ") ")
				set i to i + 1
			on error
				tell application "Finder" to set targetFolder to ¬
					make new folder at folder targetFolder with properties {name:(_date & " (" & i & ") ")}
				exit repeat
			end try
		end repeat
	end try
	tell application "Finder" to repeat with finderItem in (get selection)
		duplicate (contents of finderItem) to targetFolder with replacing
	end repeat
end backupFinderSelectionToDesktop

backupFinderSelectionToDesktop()