6.2.8.3 clonefile

Clone one or more files.

Purpose

The clonefile command allows you to create a writable clone of a file or group of files.

Syntax

clonefile source target [ source target ]... [ --exclude exclude-spec ]...

Command Options

The options for the clonefile command are:

  • source: Specifies the name of the file or files that are the clone source.

  • target: Specifies the name of the file or files that are the clone destination.

  • --exclude: Specifies the name of the file or files that are excluded from the clone operation.

Usage Notes

Note the following information when using this command:

  • You can use a wildcard (*) in the source to specify multiple source files, in which case the corresponding target must also contain a matching wildcard.

  • All files in a clone operation must be in the same vault, otherwise and error is returned.

  • Multiple source and target pairs are permitted. In this case, the source file specifications are considered in order, and only the first match is used.

  • Files specified using the --exclude option are excluded from the clone operation. Such exclusions apply across all of the source and target pairs.

  • If you specify a null (empty) string as a target value, no clones are created for the corresponding source. Specifying a null target is an alternative method of excluding files from the clone operation.

    The source and null target is considered in order along with all other source and target pairs, and only the first match is used.

  • All clones created in the same operation are point-in-time consistent.

Examples

Example 6-76 Clone a File

The following example shows cloning a file. The source file @MYDATA/file-1 is and the clone is @MYDATA/clone-file-1.

@> clonefile @MYDATA/file-1 @MYDATA/clone-file-1

Example 6-77 Clone a Group of Files

The following example shows cloning a group of files using a wildcard. Assuming the existence of files named @MYDATA/file1, @MYDATA/file2, and so on, the example creates a clone of @MYDATA/file1 named @MYDATA/clone-dir/file1, @MYDATA/file2 named @MYDATA/clone-dir/file2, and so on.

@> clonefile @MYDATA/file* @MYDATA/clone-dir/file*

Example 6-78 Clone Multiple File Groups

The following example shows cloning multiple groups of files. The example clones @MYDATA/a* and @MYDATA/b*, with the resulting clones located under @MYDATA/clone/.

@> clonefile @MYDATA/a* @MYDATA/clone/a* @MYDATA/b* @MYDATA/clone/b*

Example 6-79 Ordering Significance

These examples show the significance of the order in which the source and target pairs are specified.

In the first command, the clones for files matching @MYDATA/a* are created in @MYDATA/clone/a, and the clones for the other files are created in @MYDATA/clone/other.

@> clonefile @MYDATA/a* @MYDATA/clone/a/a* @MYDATA/* @MYDATA/clone/other/*

In the following command, all of the clones are created in @MYDATA/clone/other because all of the files match @MYDATA/*. In this case, the second source and target pair is never used.

@> clonefile @MYDATA/* @MYDATA/clone/other/* @MYDATA/a* @MYDATA/clone/a/a*

Example 6-80 Clone a Group of Files with Exclusions

The following examples show cloning files in @MYDATA, except for those matching with @MYDATA/a* or @MYDATA/b*.

@> clonefile @MYDATA/* @MYDATA/clone/* --exclude @MYDATA/a* --exclude @MYDATA/b*
@> clonefile @MYDATA/a* "" @MYDATA/b* "" @MYDATA/* @MYDATA/clone/*

Example 6-81 Invalid Commands

The following examples show invalid commands. The first and second commands are invalid because multiple vaults are referenced. The final command is invalid because the clone destination does not contain a wildcard to match the source specification.

@> clonefile @MYDATA/a* @MYDATABACKUP/a*
@> clonefile @MYDATA/a* @MYDATA/clone/a* @VAULT2/a* @VAULT2/clone/a*
@> clonefile @MYDATA/withwc* @MYDATA/clone/withoutwc