AppleScript to work with trashed files

Hi, Some time ago I made an appleScript that will move all items in the trash to a folder.

tell application "Finder"
	try
		set q to "brian:Desktops:Trashfolder" as alias
		set x to name of every file in trash
		move every item in trash to folder (q)
	end try
end tell

It worked fine for some time, but know I am getting this error:

It may be because I have some flash driver with garbage of there own! I tried to add some code to the script:

but it does not work… Any idea in how to specify the disk?

Thank you for your time!

Brian

Hi Brian

You can change the move line so that it will overwrite duplicates:

tell application "Finder"
	--try
	set q to "Macintosh HD:Users:UserName:Desktop:Trashfolder:" as alias
	set x to name of every file in trash
	move every item in trash to folder (q) with replacing
	--end try
end tell

but your path to the Desktop wasn’t correct anyway:
“brian:Desktops:Trashfolder”
Don’t know if that was just for the example shown here