Changing a name and moving a file

Thanks. It’s becoming clearer.

Hi,

Here’s a quick example with very little error checking:

adding folder items to this_folder after receiving these_items
repeat with i in these_items
	tell application "Finder" to set item_name to name of i
	if last word of item_name is "copy" then
		repeat
			if last word of item_name is "copy" then
				try
					set item_name to (characters 1 thru -6 of item_name) as string
				on error
					-- do nothing, the name will be "copy"
					exit repeat
				end try
			else
				exit repeat
			end if
		end repeat
		tell application "Finder" to set name of i to item_name
	end if
	tell application "Finder"
		move i to (container of this_folder) with replacing -- do you want it to replace?
	end tell
end repeat
end adding folder items to

gl

Wow! Thanks. I’ll give it a try and tell you how it worked.