• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Renaming a copied file with Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming a copied file with Finder


  • Subject: Re: Renaming a copied file with Finder
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 9 Oct 2006 16:29:38 +0200


Le 9 oct. 2006 à 16:21, Michelle Steiner a écrit :

On Oct 9, 2006, at 3:10 AM, ishmael wrote:

I 'd like the new file to be saved with a different name, without
overwrite the old one (something like "filename (2)" ): is there any
option of the Finder's copy command I can use? some like the "without
replacing" one...

Not that I've been able to figure out.

Otherwise, i could catch the error (15267), and copy the file with a
new name: how can i do that with Finder?

Best as I can tell, you can't do it directly. Here is my work around.

set file_to_copy to (choose file)
set target_folder to (choose folder)
tell application "Finder"
try
duplicate file_to_copy to target_folder without replacing
on error msg number num
if num is -15267 then
set new_name to display dialog msg & " Please choose another name for the copy." default answer (name of file_to_copy) & " copy"
set new_file to duplicate file_to_copy
move new_file to target_folder
else
display dialog msg
end if
end try
end tell

and what if (name of file_to_copy) & " copy" already exists ? ;-)

Yvan KOENIG _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Renaming a copied file with Finder
      • From: Christopher Nebel <email@hidden>
    • Re: Renaming a copied file with Finder
      • From: Simon Forster <email@hidden>
    • Re: Renaming a copied file with Finder
      • From: Michelle Steiner <email@hidden>
References: 
 >Renaming a copied file with Finder (From: ishmael <email@hidden>)
 >Re: Renaming a copied file with Finder (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Renaming a copied file with Finder
  • Next by Date: Re: Renaming a copied file with Finder
  • Previous by thread: Re: Renaming a copied file with Finder
  • Next by thread: Re: Renaming a copied file with Finder
  • Index(es):
    • Date
    • Thread