About the Copy utility

This topic provides details about how the Copy utility works.

The Copy utility supports wildcards (* and ?) and recursive copying. In some cases, the destination directory must already exist; in others, the utility automatically creates both the destination directory and any empty directories in the transfer.

Directories are copied first to a temporary directory on the destination machine before being copied one file at a time to the target location. You can configure the location of this temporary directory in the eac.properties file, using the optional setting com.endeca.eac.filetransfer.fileTransferTempDir as follows: If the Copy utility tries to copy a file to a location where another file already exists, the utility overwrites the preexisting file.
Note: The Copy utility supports both SSL and non-SSL communication, with SSL being off by default. For details on enabling SSL, see the Endeca Security Guide.

Destination directories

In most cases, the destination directory where the copied files are placed has to exist already. However, there are a few exceptions where the destination directory does not have to exist prior to the copy:
  • Copying just one file to the location of an existing file.
  • Copying just one file to a new file name in an existing directory.
  • Copying just one directory to a new directory name in an existing parent directory.

Failure and recovery

The following situations result in a failure of the Copy utility:
  • The Copy utility tries to write to a directory it doesn’t have permissions to.
  • There is not enough disk space.
  • There is no file at the source location.
  • The wildcard expression matches no files.
  • When there are mismatches between directories and files (for example, the Copy utility tries to copy a file to path where a directory with that name already exists, or tries to create a directory in the destination and a file with that name already exists).
  • You cannot use .. to create paths that do not exist. For example, the path /temp/../../a.txt refers to a path that is above the root directory. This is an invalid path that causes the utility to fail.
  • Asking for a copy that results in multiple files being written to the same location. For example, given the following directory structure on the source:
    /trunk/src/a.txt
    /testbranch/src/a.txt
    

    a copy from /t*/src/* to /temp would result in the Copy utility trying to write both a.txt files to the same location in the temp directory.

There is no recovery for copies. Therefore, if the transfer of a large file fails, the entire file must be transferred again. Likewise, if a multi-file transfer fails before completion, you must either re-run the entire transfer or request only those parts that did not transfer.

Explicit machine naming

Keep in mind that when you are using the Copy utility, you are potentially working with three machines: the EAC Central Server, from which you issue eaccmd commands, the Agent machine you are copying data from, and the one you are copying data to. In such cases, the name localhost can be confusing. Unless you are using the Copy utility to move files on a single machine, you should use explicit machine names rather than simply localhost.

Delimiting wildcard elements

To prevent inappropriate expansion, any wildcard arguments you use with the Copy utility in eaccmd need to be delimited with double quotation marks. For example:

On Windows, "C:\*.txt".

On UNIX, "/home/endeca/test/*.txt".

Copying across platforms

If you are copying files or directories between machines on different platforms, you have to wrap any Window paths on a Linux or Solaris shell in double quotation marks (for example, "C:\*.txt").