Copy Finder Files to original folder

Hi – I’m trying to make a workflow that duplicates a file and datestamps the duplicate. For example, it would take “news.html” and create a copy called “news_050913.html” in the same folder as the original, which is left unchanged.

OK, so I can get it to create the new timestamped file. However, it always copies it to the Desktop (or wherever is specified in the To: dropdown of the Copy Finder Items action). Is there any way I can get this thing to copy the file to the same folder it came from? I just want it to work like “Duplicate” does in the Finder, but I can’t seem to find a way to make Automator behave this way.

Been a while, but maybe others will find this useful. Automator replaces a file it you try to copy it to the same location.

Try this in a Run AppleScript action:

tell app "Finder"
duplicate selection
end tell

This just dupes a file the old fashioned way: with " copy" after it. The Automator only option would be:

Copy Finder Items (different location)
Rename Finder Items ( add text " copy")
Move Finder Items (back to original location)

Kevin

So If you were converting a bunch of files from different folders, say from html to rich text, is there no way to have them be saved back to the original location?

Deb

Probably over complicated. but works.

global the_Final_name
tell application "Finder"
	set these_items to selection
	
	
	repeat with i from 1 to number of items in these_items
		set this_item to item i of these_items as alias
		tell application "Finder"
			set this_Name to name of this_item
			set str to (day of (current date)) & year of (current date) & time of (current date) as string
			my _set(this_Name)
			set dupe to duplicate this_item
			set duppe_ext to "." & name extension of this_item
			set the_Final_name to the_Final_name & str & duppe_ext as string
			set name of dupe to the_Final_name
		end tell
	end repeat
end tell
on _set(this_Name)
	
	set AppleScript's text item delimiters to {"."}
	set line_start to text item -2 of this_Name
	set AppleScript's text item delimiters to ""
	set the_Final_name to line_start & "_" as string
end _set