could do with some help with this please?

Hi all, I can’t see why this doesn’t work?!

I have this script to copy the contents of a folder (folders containing jpgs) called hires, the folder and all it contents (including hierarchy folder & images) are then converted to zip files, with the extension .jpg.zip… this is perfect, but it gives up after a couple of files, with a ditto error.!

property sPath : “defender:Users:aw:Desktop:test:hires:”
property dPath : “defender:Users:aw:Desktop:test:zips:”

tell application “Finder”
set folderList to every folder of folder sPath
repeat with oneFolder in folderList
set FolderName to name of oneFolder
set itemList to every file of oneFolder
repeat with oneItem in itemList
set itemPath to oneItem as string
set itemPath to quoted form of POSIX path of itemPath
set itemName to (name of oneItem)

		--this saves the zip with the file extension (name.jpg.zip)
		set savePath to quoted form of POSIX path of dPath & FolderName & "/" & itemName & ".zip"
		
		-- this saves the zip without file extension (name.zip)
		--set fileExt to name extension of oneItem
		--set extCount to (count of fileExt) + 1
		--set savePath to quoted form of POSIX path of dPath & FolderName & "/" & text items -extCount thru 1 of itemName & "zip"
		
		try
			make folder in folder dPath with properties {name:FolderName}
		end try
		do shell script ("/usr/bin/ditto -c -k -rsrc --keepParent " & itemPath & " " & savePath)
	end repeat
end repeat

end tell

can anyone shed any light on this please?

wilse :oops:

What’s the error? Could it be a rights issue?

P.S. – single quote your path parameters – it doesn’t matter in this case since there are no spaces in your paths, but it’s good form and will help if you ever change the paths.