latch cp#

The command latch cp allows files and directories to be uploaded to Latch, downloaded from Latch, or copied within Latch remotely.

Usage#

latch cp [OPTIONS] src dest

Both src and dest must either be Latch URLs or local file paths. They cannot both be local paths.

If src is a local path, this command will upload src to dest. If dest is a local path, this command will download src to dest. If src and dest are both Latch URLs, a remote copy will be requested.

Supported Options#

  • --help: Show a help message and exit.

  • -v, --verbose: Print each file’s name as it is copied.

  • --progress: Set the type of progress information to show while copying. Valid options:

    • none: Don’t show any progress info.

    • total: Show a single progress bar describing the total progress of the copy. If copying a file, the units of this bar will be bytes. Otherwise, the units will be files.

    • tasks: The default. Show a progress bar for each task as well as a total bar.

Uploading/Downloading#

When uploading or downloading, the behavior of latch cp is identical to that of Unix cp -R. Directories are copied recursively, and if any parents of dest don’t exist, the copy will fail.

Remote Copying#

When remote copying, the actual copy is done asynchronously - calling latch cp simply requests a copy.

Remote copying is especially useful for copying files between workspaces.

Examples#

$ latch cp test.txt latch://123.account/test.txt
# uploads test.txt to /test.txt in account 123
$ latch cp latch://123.account/stuff/ ../things
# downloads the contents of /stuff and puts them into ../things
$ latch cp latch://123.account/hello latch://456.account/bye
# requests a copy of /hello (in 123) to /bye (in 456) (cross-workspace copy)