copy

The copy task uploads a file or a set of files to a DataPower device from a local file system. copy is capable of uploading multiple files at once.

copy also creates a directory structure containing the files similar to the standard Ant copy task. copy automatically creates necessary directories on the device to reproduce the local directory tree.

copy relies on the nested dpFileset element(s) to determine which files and directories to create and upload.

Attributes/Options

Name

Description

Required

toDir

Specifies the target directory for uploaded files on the device. It could include a filesystem which is defined using filesystem:/ syntax. If not provided, the filesystem will default to local:/.

You can override toDir at the fileset level.

No

cleanDirectories

If true, delete target directories on the device before uploading files. Root directories (i.e., local:/) will not be cleaned. Use the delete task with patterns to remove all files from local:/.

Defaults to false.

No

flatten

If true, do not create any subdirectories; create only root directories on the device.

Defaults to false.

No

flushCache

If set to true, flush the document and stylesheet caches for all XML managers after all files are copied.

Defaults to false.

No

transformOnly

If set to true, DPBuddy will transform the files according to the nested transform element, but it will not copy the files to the device. In this mode the task does not connect to DataPower.

This is convenient for developing/troubleshooting transform actions.

Defaults to false.

No

dir

The root of the local directory tree that will be copied to DataPower. DPBuddy implicitly creates a nested fileset using this directory and includes or excludes patterns if provided.

No

includes

Comma- or space-separated list of patterns of files that must be included in Ant pattern format.

Defaults to “**” (all files are included when omitted).

No

excludes

Comma- or space-separated list of patterns of files that must be excludes in Ant pattern format.

Defaults to ‘none’ (no files, except default Ant excludes, are excluded when omitted.)

No

file

Path to the file to copy. Can’t be combined with includes/excludes.

No

rollbackOnError

If set to true, roll back the domain’s configuration to the last checkpoint (if it exists), in case of any errors.

Defaults to false.

No

domainPatterns
CLI alias: domains

Comma-delimited list of regular expression patterns defining what domains to apply the command to. Use ‘.*’ for all domains except the default. Use ‘.*,default’ to include the default domain.

Defaults to the current domain. The current domain is specified using the dpDomain property or domain attribute of the task.

No

dpFileset Nested Element

dpFileset defines what files on the local file system will be uploaded to the device. dpFileset supports all attributes and nested elements of the regular Ant fileset. In addition, you can specify the toDir attribute, which defines the root directory (and, optionally, the file system) on the device.

dpFileset also supports nested transform element explained in the next section.

If toDir at the fileset and task levels are omitted, DPBuddy will use the local:/ filesystem and the base directory of the fileset (the directory specified by the dir attribute of the fileset) as the root on the device.

If flatten is set to true, DPBuddy will upload all files into the root directory.

You can specify multiple dpFileset elements within the same task.

Name

Description

Required

toDir

Specifies the target directory for uploaded files on the device. It could include a filesystem which is defined using the filesystem:/ syntax. If not provided, the filesystem will default to local:/.

You can specify default toDir at the task level.

No

matchRequired

If set to true, fail if no files matched this fileset. If the base directory for the fileset is also optional, use Ant attribute erroronmissingdir=false in addition to matchRequired.

Defaults to true. Note that this behavior is different from the regular Ant fileset.

No

transform Nested Element

transform contains transformation actions documented in Transforming DataPower Configuration. This element is optional. It must be nested within the dpFileset element.

These transformation actions apply to all matching files. Use multiple dpFileset elements if the transformations should only be applied to a subset of the files being copied.

Note that transformation actions can be applied only to XML files. All non-XML files should be specified in a separate dpFileset which does not have any transformations.

Examples

Suppose there is a local directory services/person/wsdl containing some wsdl and xsd files. The following command will create local:/apps/services/person/wsdl directory tree on the device and upload the files. Since cleanDirectories is set to true, it will delete the directory local:/apps/services before uploading the files.

dpbuddy copy -toDir "/apps/services" -includes "**/*.wsdl **/*.xsd" -cleanDirectories
<dp:copy cleanDirectories="true">
    <dpFileset toDir="/apps/services"
               dir="services" includes="**/*.wsdl **/*.xsd"/>
</dp:copy>

You can find more examples under samples in your distribution or online.