Setup
1
Install the Latch CLI:
The Latch CLI requires Python >=3.8 and < 3.11.
2
Next, authenticate your account. This can be done one of two ways:
- On a machine with a browser
- On a machine without a browser
If you’re on a computer where you’re logged into console.latch.bio, simply enter
latch login
which will authenticate you through the browser that you’re logged into.3
By default, LatchCLI references your personal workspace. To switch workspaces, use the command:
4
Verifiy the authentication works
Verify that the authentication works and that you are in the desired workspace by typing:Check that the content displayed in the terminal matches your files and folders on https://console.latch.bio
Copying Data
1
Upload files from local machine to Latch Data:
file.txt
and puts it into welcome/
on Latch.2
Download files from Latch Data to local machine:
/welcome
on Latch and puts them into local_folder
on your local computer.3
Copy files between two Latch Data paths in the same workspace:
/dir1
on Latch and puts them into /dir2
on Latch.4
Copy Latch Data files between two different workspace:
/dir1
in workspace 123 and puts them into /dir2
in workspace 456.You can find the remote path of the file you want to copy in the sidebar of the Latch Console

Moving Data
You can also move data between two Latch directories. For example, the following command will createfile.txt
in dir2
and remove it from dir1
in your current workspace.
Syncing Data
The Latch CLI provides a simple way to sync data from a local directory to a Latch Data directory. For example, the following command will update the contents ofdir1
in Latch Data with the contents of local_folder
on your local computer.
local_folder
and rerun the above command, the changes will be reflected in dir1
in Latch Data. The sync
command will only upload files when:
- The file does not exist in the remote directory.
- The last modified time of the file in the remote directory is older than the last modified time of the file in the local directory.
sync
command will not remove files from the remote directory if they are removed from local_folder
on your local computer. To allow files to be deleted from the remote directory, use the --delete
flag:
Other Commands
- List files in
dir1
: - Create directory
dir3
, creating parent directoriesdir1
anddir2
if they do not exist: - Recursively remove
dir2
in Latch Data:
Behavior
All of the above commands follow the same behavior as their corresponding UNIX command.
-
Using wildcards (*):
This copies all content within
local_directory
tolatch_folder
: -
Using trailing slashes:
This copies the directory itself and uploads it to
latch_folder
: -
Omitting the trailing slash:
This has the same behavior as
latch cp local_directory/ latch:///latch_folder
.
DEPRECATED
The following commands have been deprecated and will not be available for Latch SDK version >= 2.39.2. To check which version of latch you are using, runlatch --version
.
latch rm
- Uselatch rmr
insteadlatch mkdir
- Uselatch mkdirp
insteadlatch touch
- No longer supportedlatch open
- No longer supported