Can't delete jpgs

I have an applescript which runs at the end of a Lightroom photo export. It takes a published set of photos and automatically saves them to two different resolutions and puts them in separate folders. Feel free to use it if you need this same kind of functionality. It creates two folders, “High Res” and “Low Res” and then takes the exported photos and resaves two sets of high res and low res photos, each in their own folder. The final step of the script is what I’m trying to figure out. Once the low res and high res folders and files have been saved, I want to delete the originally published jpgs from the folder root. Seems like I have the proper code for this below, however I am getting the following error dialogue:

Can’t get <> “/Users/mac/Dropbox/Client Photos/Colleen Long/3423 Gloucester/” of application “Finder”.

Can someone show me how to get the delete working?

Thanks!!

My Code:

on open of myFiles

tell application "Finder"
	set p to (target of front Finder window) as text
	make new folder at p with properties {name:"Low Res"}
end tell

set newSizes to {2048}

repeat with aFile in myFiles
	set filePath to aFile's POSIX path
	set bPath to (do shell script "dirname " & quoted form of filePath)
	tell application "System Events" to set fileName to aFile's name
	repeat with newSize in newSizes
		do shell script "sips " & quoted form of aFile's POSIX path & " -Z " & newSize & " --out " & quoted form of (bPath & "/Low Res/" & rename(fileName, "low-res") as text)
	end repeat
end repeat

tell application "Finder"
	set p to (target of front Finder window) as text
	make new folder at p with properties {name:"High Res"}
end tell

set newSizes to {5000}

repeat with aFile in myFiles
	set filePath to aFile's POSIX path
	set bPath to (do shell script "dirname " & quoted form of filePath)
	tell application "System Events" to set fileName to aFile's name
	repeat with newSize in newSizes
		do shell script "sips " & quoted form of aFile's POSIX path & " -Z " & newSize & " --out " & quoted form of (bPath & "/High Res/" & rename(fileName, "high-res") as text)
	end repeat
end repeat



tell application "Finder"
	delete (every document file of folder bPath whose name ends with ".jpg")
end tell

end open

on rename(fName, fSize)
do shell script “sed 's/high-res/” & fSize & "/’ <<< " & quoted form of fName
end rename

First, post questions & problems in the AppleScript | Mac OS X forum.
Code Exchange is intended for working solutions.

Your problem: you are giving a POSIX (slash delimited) path to Finder, which it cannot handle.
You must turn the bPath variable into HFS (colon delimited) first:

-- turn POSIX into HFS
set bPath to POSIX file bPath --> file "blah:blah:"
-- loose the 'file'
set bPath to bPath as text --> "blah:blah:
-- can be done in one line:
set bPath to POSIX file bPath as text

tell application "Finder"
	delete (every document file of folder bPath whose name ends with ".jpg")
end tell

Perfect! Thank you! And thanks for the advice on where to post such questions. First time poster here. I have an additional question about this script, but I went ahead and posted it in the section you advised. Thank you!