Transfer data by using SFTP commands

You can upload, download, and manage files in Cloud Storage buckets by using standard SFTP commands. The following table describes the SFTP commands and optional flags that are supported by Cloud FTP.

Command Description
cd PATH Change directory.
get REMOTE_PATH [LOCAL_PATH]

Download a file from a bucket.

If you omit the LOCAL_PATH name, the file is downloaded with the same name as the Cloud Storage file.

To recursively download all files from a folder, include the -R flag: get -R REMOTE_PATH.

ls

List the files in the current directory.

You can refine the list of files by including one or more of the following flags:

  • -1: list the files in a single column.
  • -a: list all files, including files that start with a dot (.).
  • -f: don't sort the files. The default sort order is lexicographical.
  • -h: when used with the -l flag, include unit suffixes for file size.
  • -l: include additional file information, like file size and last modified time.
  • -r: sort files in reverse order.
  • -S: sort files by file size.
  • -t: sort files by last modification time.

To list the files within a different directory, include the directory name: ls PATH.

mkdir PATH Create a directory.
put LOCAL_PATH [REMOTE_PATH]

Upload a local file to a bucket.

If you omit the REMOTE_PATH name, the file is uploaded to Cloud Storage with the same name as the local file. If a file with this name already exists, the new file overwrites the existing file.

To recursively upload all files in a folder, use the -R flag: put -R LOCAL_PATH.

progress Toggle the display of the progress meter.
pwd Display the current remote working directory.
rename OLD_PATH NEW_PATH

Rename a file.

Rename a directory, in buckets that have hierarchical namespace enabled.

The file that you're renaming must be in the current directory, and the destination directory must already exist.

rm PATH Delete a file from a bucket.
rmdir PATH Delete a directory. You must delete all files from a directory before you can delete the directory.
version Display the SFTP protocol version.
bye, exit, or quit Exit the SFTP session.

What's next