• 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: Michelle Steiner <email@hidden>
  • Date: Mon, 9 Oct 2006 09:59:25 -0700

On Oct 9, 2006, at 9:27 AM, Christopher Nebel wrote:

It's irrelevant, because that block will never be executed. The Finder's "duplicate" command (without replacing) will rename the new file as necessary ("foo copy n") to avoid a collision. ("How do I get a reference to the new file if I don't know its name?", you ask? "Duplicate" returns a reference to the new file as its result.)

Copying within the same folder, yes. But my experience is if the copy is to a different folder, it creates an error instead.


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
		log msg
	end try
end tell


The log: tell current application choose file alias "Dora:Users:michelle:Desktop:a:video.ws" choose folder alias "Dora:Users:michelle:Desktop:b:" end tell tell application "Finder" (*An item with the same name already exists in the destination.*) end tell

--
If you always reach your goals, you set the bar too low. If you never reach your goals, you set the bar too high.


_______________________________________________
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>
References: 
 >Renaming a copied file with Finder (From: ishmael <email@hidden>)
 >Re: Renaming a copied file with Finder (From: Michelle Steiner <email@hidden>)
 >Re: Renaming a copied file with Finder (From: Yvan KOENIG <email@hidden>)
 >Re: Renaming a copied file with Finder (From: Christopher Nebel <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