Skip to content
Back to top

    copy [options] file-or-dir-to-copy ...

Copy files and directories from local to remote hosts. The specified files are assumed to be relative to the HOME directory and copied to the HOME on the remote. Directories are copied recursively. If absolute paths are used, they are copied as is.

# Options

--glob [=no]

  Interpret file arguments as glob patterns. Globbing is based on standard wildcards with the addition that `/**/` matches any number of directories. See the detailed syntax.

--dest <DEST>

  The destination on the remote host to copy to. Relative paths are resolved relative to HOME on the remote host. When this option is not specified, the local file path is used as the remote destination (with the HOME directory getting automatically replaced by the remote HOME). Note that environment variables and ~ are not expanded.

--exclude <EXCLUDE>

  A glob pattern. Files with names matching this pattern are excluded from being transferred. Only used when copying directories. Can be specified multiple times, if any of the patterns match the file will be excluded. If the pattern includes a `/` then it will match against the full path, not just the filename. In such patterns you can use `/**/` to match zero or more directories. For example, to exclude a directory and everything under it use `**/directory_name`. See the detailed syntax for how wildcards match.

--symlink-strategy <SYMLINK_STRATEGY>

  Control what happens if the specified path is a symlink. The default is to preserve the symlink, re-creating it on the remote machine. Setting this to `resolve` will cause the symlink to be followed and its target used as the file/directory to copy. The value of `keep-path` is the same as `resolve` except that the remote file path is derived from the symlink’s path instead of the path of the symlink’s target. Note that this option does not apply to symlinks encountered while recursively copying directories, those are always preserved. Default: `preserve` Choices: `keep-path`, `preserve`, `resolve`