ControlTier > core
 

copy

Command Reference

Description

Copy a resource

The davutil copy command supports several modes of operation.

  1. Copy resource URI to a local file (ie, GET).
  2. Copy local file to a resource URI (ie, PUT).
  3. Copy a resource URI to a destination URI (ie DAV COPY).
  4. Create a copy of a local file (ie., file copy).

This command includes two optional parameters, -overwrite and -backup, that are useful to control the preservation of an existing file that would be replaced by the copy operation.

static: This command can be run outside of an object context.

Usage

ctl -m davutil -c copy [-backup] -dest <> [-overwrite] [-password <>] -src <> [-suffix <.backup>] [-username <>]

Options

Option Description Type Default
backup if present make a backup if the dest file exists, is local, and -overwrite is specified boolean
dest Destination file path or URL.

This can be a local file path (to copy to a local file), or a URL on the DAV server. This supports the dav:// shortcut schema.

string
overwrite if present overwrite existing file or resource boolean
password DAV user name string ${entity.attribute.password}
src Source file path or URL.

This can be a local file path (to copy from a local file), or a URL on the DAV server. This supports the dav:// shortcut schema.

string
suffix suffix of backup file string .backup
username DAV user name string ${entity.attribute.username}

Examples

Example 1: Copy a resource URI to a local file and backup existing copy:

ctl -m davutil -c copy -- \
      -src dav://junk/fun \
	  -dest /tmp/fun/file1 -backup

Note: The src URI must refer to a resource and not a resource collection. If a collection is specified then an HTML file will be returned as a result that contains a human readable listing of the collection.

Example 2: Copy a local file to the destination URI in the WebDAV repository:

ctl -m davutil -c copy -- \
	  -src /tmp/fun/file1 \
      -dest dav://junk/fun
	  

Example 3: Copy source URI to the destination URI in the WebDAV repository:

ctl -m davutil -c copy -- \
      -src dav://junk/fun \
      -dest dav://junk/fun_copy