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