Finder.duplicate

Syntax Finder.duplicate (path, duplicateTo, replacing)

Params path is the path name of the folder, document, or application of which you wish the Finder to make a copy (For the Scriptable Finder, path may also be a list of items to duplicate).

duplicateTo (Scriptable Finder only) if present names the container into which the duplicate item(s) are placed.

replacing (Scriptable Finder only) if present may be false (the default), true, conflicts, or existingItems...any of the last three causes existing items to be replaced by the newly-created items

Action The original Finder creates a copy of the object at path, adding the word "Copy" to the end of its name.

The Scriptable Finder does the same if the duplicateTo parameter is not given (but will copy multiple items in different containers)

If the duplicateTo parameter is included, the copied items go into the designated container.

If duplicateTo is a list of containers, copies of the items to duplicate appear in each of the containers

If replacing is false or not included, it is an error if there already exists a conflicting item (except when the Finder's Duplicate menu command action is specified by omitting duplicateTo and replacing)

Returns Original Finder: true; Scriptable Finder: an object specifier (or list of specifiers) for the newly created item(s)

Examples Finder.duplicate ("System:Frontier Folder:Frontier.root") « original or Scriptable Finder
» true (original Finder) or startupDisk.folder["Frontier Folder"].file["Frontier.root"] (Scriptable Finder)

Finder.duplicate ("System:Frontier Folder:Frontier.root", "System:Backup Root:", true)
» startupDisk.folder[Backup Root].file["Frontier.root"] (prior backup deleted)

Platform Notes This verb is only implemented in the Mac OS version of Frontier.

Errors It is an error to use the duplicateTo parameter with the replacing parameter omitted or false, if there is already an existing item with the same name in the duplicateTo container

It is an error if the duplicateTo parameter is other than a container

Notes The only form for use with the non-Scriptable Finder is Finder.duplicate (path)

If a copy of the file already exists, this verb with only the path parameter behaves like the Finder and names the new copy by adding a number to the end of the name (e.g., "Frontier.root Copy 2").

See Also file.copy

Discuss