rclone Cloud Storage Sync

rclone cheatsheet — sync, copy, mount cloud storage. rclone sync src dst, rclone copy, rclone ls, rclone mount. Works with S3, GCS, Drive, Dropbox, and 40+ providers.

8 min read

What it is

rclone is a command-line program to manage files on cloud storage. It’s like rsync for cloud storage, supporting a vast array of providers.

Installation

Linux:

curl https://rclone.org/install.sh | sudo bash

macOS:

brew install rclone

Windows:

Download the executable from the rclone downloads page and add it to your system’s PATH.

Core Concepts

  • Remotes: rclone interacts with cloud storage providers through "remotes." A remote is essentially a configuration that stores your credentials and the type of cloud storage you’re connecting to (e.g., "myS3" for an Amazon S3 bucket, "myGDrive" for Google Drive). You set these up using rclone config.
  • Paths: Paths within rclone are specified as remoteName:path/to/file_or_directory. For example, myGDrive:Documents/Reports refers to the 'Reports' directory within the 'Documents' folder on your configured Google Drive remote.

Commands / Usage

Configuration

  • rclone config: Interactive tool to set up new remotes. You’ll be prompted to name your remote, choose the storage type, and enter your authentication credentials.
    • rclone config show: Displays the current rclone configuration file.
    • rclone config dump: Dumps the configuration to stdout in JSON format.
    • rclone config create <remote_name> <storage_type>: Non-interactive creation of a remote.

Listing and Inspecting

  • rclone lsd <remote>:<path>: List directories on a remote.

    rclone lsd myS3:backups/daily
    

    Lists directories in the backups/daily path on the myS3 remote.

  • rclone ls <remote>:<path>: List files on a remote.

    rclone ls myDropbox:photos/2023
    

    Lists files in the photos/2023 path on the myDropbox remote.

  • rclone lcc <remote>:<path>: List common directories.

    rclone lcc myGDrive:
    

    Lists common directories in the root of your Google Drive.

  • rclone size <remote>:<path>: Show the total size of files on a remote.

    rclone size myOneDrive:Documents
    

    Displays the total size of files in the Documents folder on myOneDrive.

  • rclone about <remote>:<path>: Display storage space usage.

    rclone about myBackblaze:
    

    Shows free and used space for your Backblaze B2 bucket.

  • rclone check <remote1>:<path1> <remote2>:<path2>: Check if files in two locations match.

    rclone check /home/user/data myGDrive:data_backup
    

    Compares local /home/user/data with myGDrive:data_backup.

  • rclone cryptcheck <remote>:<path> <remote>:<path>: Check encrypted files against their cleartext counterparts.

    rclone cryptcheck /home/user/encrypted_data myGDrive:encrypted_backup
    

    Checks if the encrypted files on myGDrive match the local unencrypted files.

Copying and Moving

  • rclone copy <source> <destination>: Copy files from source to destination.

    rclone copy /home/user/photos myGDrive:photos_backup --progress
    

    Copies local photos directory to myGDrive:photos_backup and shows progress.

  • rclone move <source> <destination>: Move files from source to destination.

    rclone move /home/user/temp_files myS3:archive/old_files
    

    Moves local temp_files to myS3:archive/old_files.

  • rclone sync <source> <destination>: Sync source to destination, making destination identical to source.

    rclone sync /home/user/website_files myFTP:public_html --dry-run
    

    Simulates syncing local website_files to myFTP:public_html.

Deleting

  • rclone delete <remote>:<path>: Delete files on a remote.

    rclone delete myGDrive:temp_uploads --min-age 7d
    

    Deletes files in myGDrive:temp_uploads older than 7 days.

  • rclone purge <remote>:<path>: Delete a directory and its contents on a remote.

    rclone purge myS3:old_backups
    

    Deletes the entire old_backups directory on myS3.

Downloading and Uploading

  • rclone copy <remote>:<path> <local_path>: Download files from a remote.

    rclone copy myDropbox:documents /home/user/downloaded_docs
    

    Downloads documents from myDropbox to the local /home/user/downloaded_docs directory.

  • rclone copy <local_path> <remote>:<path>: Upload files to a remote.

    rclone copy /home/user/projects/my_app myGDrive:apps/my_app
    

    Uploads the local my_app directory to myGDrive:apps/my_app.

Filtering

  • --include <pattern>: Include files matching the pattern.

    rclone copy /data myGDrive:data --include "*.jpg"
    

    Copies only JPG files from /data to myGDrive:data.

  • --exclude <pattern>: Exclude files matching the pattern.

    rclone copy /data myGDrive:data --exclude "*.tmp"
    

    Copies all files except .tmp files from /data to myGDrive:data.

  • --filter <rule_file>: Use a file containing filtering rules.

    rclone copy /data myGDrive:data --filter "filter_rules.txt"
    

    Applies rules from filter_rules.txt.

  • --files-from <file>: Read file list from the given file.

    rclone copy /data myGDrive:data --files-from /home/user/file_list.txt
    

    Copies only the files listed in file_list.txt from /data.

Transfer Options

  • --progress: Show progress during transfer.

    rclone copy /large/files myS3:backup --progress
    
  • --dry-run: Simulate operations without making changes.

    rclone sync /local/data myGDrive:data_sync --dry-run
    
  • --backup-dir <remote>:<path>: Move files that would be overwritten to another directory.

    rclone sync /local/data myGDrive:data --backup-dir myGDrive:data_archive/$(date +%Y-%m-%d)
    

    Syncs /local/data to myGDrive:data, moving any overwritten files to a dated archive directory.

  • --ignore-existing: Skip files that already exist on the destination.

    rclone copy /new_data myGDrive:data --ignore-existing
    

    Copies only new files from /new_data to myGDrive:data.

  • --update: Skip files that are newer on the destination.

    rclone copy /local/data myGDrive:data --update
    

    Copies files only if they are older on the destination.

  • --transfers <number>: Number of parallel transfers.

    rclone copy /big/data myS3:backup --transfers 16
    
  • --checkers <number>: Number of checkers to use.

    rclone copy /big/data myS3:backup --checkers 16
    
  • --bwlimit <rate>: Bandwidth limit (e.g., 10M for 10 MiB/s).

    rclone copy /local/files myGDrive:backup --bwlimit 5M
    
  • --create-empty-src-dirs: Create empty directories on the destination.

    rclone copy /local/data myGDrive:data --create-empty-src-dirs
    
  • --fast-list: Use faster listing methods if available.

    rclone sync /local/data myGDrive:data --fast-list
    

Encryption

  • rclone obscure <password>: Obscure a password for use in config.

    rclone obscure mysecretpassword
    
  • rclone crypt check <remote>:<path> <remote>:<path>: Check encrypted files against their cleartext counterparts.

    rclone cryptcheck myGDrive:encrypted_files myGDrive:plain_files
    
  • rclone cryptsetup: Interactive tool to set up encrypted remotes.

Other

  • rclone mount <remote>:<path> <mountpoint>: Mount a remote as a file system.

    rclone mount myGDrive:Documents /mnt/gdrive_docs --daemon
    

    Mounts Google Drive’s Documents folder at /mnt/gdrive_docs and runs in the background.

  • rclone serve <remote>:<path>: Serve files over various protocols (HTTP, FTP, WebDAV, SFTP, DLNA).

    rclone serve http myS3:public_files
    

    Serves files from myS3:public_files via HTTP.

  • rclone rmd <remote>:<path>: Remove a directory.

    rclone rmd myGDrive:old_stuff
    
  • rclone rmdir <remote>:<path>: Remove an empty directory.

    rclone rmdir myGDrive:empty_folder
    

Common Patterns

  • Backup local directory to cloud:

    rclone sync /home/user/documents myGDrive:backups/documents --backup-dir myGDrive:backups/archive/$(date +%Y-%m-%d) --progress
    

    Syncs local documents to Google Drive, moving old versions to a dated archive.

  • Download specific file types from cloud:

    rclone copy myS3:photos/2023 myGDrive:photos_archive_2023 --include "*.jpg" --exclude "*.png" --progress
    

    Copies only JPG files from myS3:photos/2023 to myGDrive:photos_archive_2023, excluding PNGs.

  • Clean up old files on cloud storage:

    rclone delete myDropbox:temp_files --min-age 30d --dry-run
    

    Finds and lists files in myDropbox:temp_files older than 30 days without deleting them. Remove --dry-run to perform the deletion.

  • Mirror a local directory to cloud storage:

    rclone sync /var/www/html myFTP:public_html --bwlimit 2M
    

    Keeps myFTP:public_html identical to /var/www/html with a 2 MiB/s bandwidth limit.

  • Copy files between two cloud providers:

    rclone copy myGDrive:photos/2023 myS3:archive/photos_2023 --transfers 8 --checkers 8
    

    Copies photos from Google Drive to Amazon S3 using 8 parallel transfers and checkers.

  • Find large files on cloud storage:

    rclone ls myS3:backups --max-size 10G | sort -rh -k1,1
    

    Lists files larger than 10GiB in myS3:backups and sorts them by size. (Note: rclone ls itself doesn’t have --max-size, this is a common shell-based filtering). A more direct rclone way is rclone lsl which shows sizes and then sort.

    rclone lsl myS3:backups | awk '$1 > 10737418240 { print }' | sort -rh -k1,1
    

    Lists files larger than 10GB and sorts them by size.

Gotchas

  • sync vs copy: rclone sync makes the destination exactly match the source. If you delete a file locally, rclone sync will delete it from the destination. rclone copy only adds or updates files; it never deletes from the destination.
  • --dry-run is your friend: Always use --dry-run with sync, delete, or purge commands until you are absolutely sure they will do what you expect.
  • Case sensitivity: Cloud storage providers vary in case sensitivity. rclone tries to abstract this, but be aware of potential differences.
  • File name restrictions: Some cloud providers have stricter rules for file names (e.g., disallowing certain characters). rclone can often handle these by renaming, but it’s good to be aware.
  • Rate limits: Cloud providers impose API rate limits. If you hit these, rclone will typically pause and retry, but aggressive operations can lead to temporary blocks. Use --transfers and --checkers judiciously.
  • rclone mount and performance: Mounting a remote as a filesystem can be convenient but may not offer the same performance as direct rclone operations for large transfers or many small files.
  • Encryption layer: rclone crypt encrypts files before they are uploaded. The remote configured for crypt stores encrypted data. You need a separate, unencrypted remote configuration to point rclone crypt to the actual cloud storage location.