14.1. 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.

14.1.1. 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 directory tree of the local files; use it in conjunction with the includes attribute.

Defaults to ./.

No
includes

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

DPBuddy implicitly creates a nested fileset using the include patterns and the value from the dir attribute.

If you need to specify exclude or other parameters of a fileset, you should explicitly define a nested dpFileset.

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

14.1.2. 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
failIfEmpty

If set to true, fail if no files matched this fileset.

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

No

14.1.3. transform Nested Element

transform contains transformation actions documented in Using DPBuddy to Transform DataPower Configuration and XML Files. 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.

14.1.4. 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.