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.
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?
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