Rclone sync vs copy - What are the differences?

Rclone sync vs copy - What are the differences? banner

Both sync and copy commands copy files from source to destination, but with one significant difference - sync will delete files from the destination that are not existent on the source.

Let's look at some examples to understand the differences better.

Rclone sync example

Sync from local to remote

rclone sync my_dir gdrive:my_dir --progress

This command will sync the local my_dir to the remote's dir my_dir. The contents of the folder will be copied, and both the source and destination will be exactly the same when the command is finished. This includes deleting files from gdrive:my_dir if necessary.

The --progress flag tells Rclone to output a real-time overview of the transfer. Without this flag, the program doesn't have any output.

Note: Use Rclone sync with caution. It may result in data loss.

I advise you to test first with  --dry-run or the --interactive/-i flag.

rclone sync --dry-run SOURCE remote:DESTINATION

The dry run flag is useful to see what Rclone would do without actually doing it.

To sync from remote to local, just switch the position of the arguments.

rclone sync --dry-run gdrive:my_dir my_dir --progress

Is it possible to use rclone sync without deleting files?

In that case, you should just use copy, because copy is essentially sync without deleting. 

Let's look at how copy works.

Rclone copy example

Copy from local to remote

rclone copy my_dir gdrive:my_dir --progress

This command will copy the contents of the local my_dir folder to the remote my_dir folder. If the remote folder doesn't exist - it is created.

No files will be removed from the destination. This is the main difference compared to sync.

Rclone copy vs copyto

Rclone also has copyto command, which is the same as copy but allows to copy single files and change their original name. If source is a directory, then it behaves exactly as copy.

rclone copyto my_dir/image.jpg gdrive:my_dir/image_with_new_filename.jpg --progress

This command will copy my_dir/image.jpg to the remote my_dir but with a new filename - image_with_new_filename.jpg.