Re: Renaming a copied file with Finder
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