• 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: Timothy Bates <email@hidden>
  • Date: Mon, 09 Oct 2006 17:59:12 +0100
  • Thread-topic: Renaming a copied file with Finder

>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.)
> --Chris Nebel
> AppleScript Engineering


I was confident that Finder scripting was not remotely this smart, and I
still think it is not:

This script:

tell application "Finder"
    duplicate file "Prelude:Users:tim:Desktop:imageR1D.png" to file
"Prelude:Users:tim:Desktop:" without replacing
end tell

Gives this result:

tell application "Finder"
    copy file "Prelude:Users:tim:Desktop:imageR1D.png" to file
"Prelude:Users:tim:Desktop:"
        "Finder got an error: Can't set file \"Prelude:Users:tim:Desktop:\"
to file \"Prelude:Users:tim:Desktop:imageR1D.png\"."


Oops. Duplicate is executed as copy and fails

That's why I wrote a bunch of handlers to do smart unused name generation

tim


 _______________________________________________
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: Paul Berkowitz <email@hidden>
References: 
 >Re: Renaming a copied file with Finder (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Rép: 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