latch cp allows files and directories to be uploaded to Latch, downloaded from Latch, or copied within Latch remotely.
latch cp [OPTIONS] src dest
dest must either be Latch URLs or local file paths. They cannot both be local paths.
src is a local path, this command will upload
dest is a local path, this command will download
dest are both Latch URLs, a remote copy will be requested.
--help: Show a help message and exit.
--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.
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.
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.
$ 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)