Friday, August 17, 2018

#1 2005-09-12 11:13:37 pm

jpf
Member
Registered: 2005-09-13
Posts: 1

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.

Offline

 

#2 2005-10-30 03:16:15 am

Kevin Wolfe
Member
From:: Cincinnati OH USA
Registered: 2005-10-27
Posts: 67
Website

Re: Copy Finder Files to original folder

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:

Applescript:

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

Offline

 

#3 2006-04-01 08:44:24 pm

ddesmone
Member
Registered: 2006-01-20
Posts: 3

Re: Copy Finder Files to original folder

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

Offline

 

#4 2006-04-02 11:00:38 am

mark hunte
Member
From:: Hello, London Calling
Registered: 2006-03-20
Posts: 1030
Website

Re: Copy Finder Files to original folder

Probably  over complicated. but works.

Applescript:

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


Tap,tap,tap , hello , testing 1..2,  1...2,
http://www.markosx.com/thecocoaquest/


Filed under: Finder

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)