RE: Duplicate item with new name to same folder?
RE: Duplicate item with new name to same folder?
- Subject: RE: Duplicate item with new name to same folder?
- From: Dennis Cox <email@hidden>
- Date: Thu, 11 May 2006 06:47:00 -0500
> ----------
> From:
> applescript-users-bounces+dcox=email@hidden on behalf
> of Ruth Bygrave
> Sent: Thursday, May 11, 2006 6:16 AM
> This _must_ be obvious, but I'm scratching my head about it.
>
> set docpath to (path to documents folder as string)
> tell application "Finder" to duplicate file XMLFile to file docpath &
> "NewFile.xml"
>
> That doesn't seem to work. I looked it up, and the book says it wants
> a folder or disc name as where to copy to.
>
> Right, so I tried
>
> tell application "Finder" to duplicate file XMLFile to docpath with
> properties {name: "NewFile.xml"
>
> That doesn't even compile. Help! What obvious thing am I missing?
>
Perhaps because you're duplicating? Wouldn't be a duplicate if you changed
the name. You need to two step it. Set the name of the original file to a
variable. Duplicate to the new location, rename using concantenation of
folder path and original name for the full file path.
tell application "Finder"
duplicate originalFilePath to anotherFolderPath
set name of file (anotherFolderPath & nameOfOriginalFile) to
whatEverNameYouWant
end tell
_______________________________________________
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