Overview
Questions
Objectives
$ rclone lsf rclone-gdrive:/
$ mkdir rclonefiles
$ cd rclonefiles
In google drive create a folder name it “rclonetest”
Within that folder create a new doc and call it “testfile”
‘rclone copy’ has a source and destination required
GDrive being the source in the example below and the current directory (represented by the ‘.’) the destination
$ rclone copy rclone-gdrive:/rclonetest .
This will copy the folder contents to the current directory - Note the ‘.’ at the end this is represents the current directory as the destination folder - we could also have used ~/rclonefiles or /home/username/rclonefiles as that same folder path.
$ cp testfile.docx testfile2.docx
‘cp’ is the copy command in the terminal/shell
$ ls
The source is the Mana testfile2.docx and the destination is gdrive
$ rclone copy testfile2.docx rclone-gdrive:/rclonetest
You can check GDrive and the file should appear!
The copy command on a folder will overwrite files that have the same name but if a files exists on the destination that isn’t in the folder being copied it will be retained on the destination (when we get to sync you will see a difference in this behavior)
The sync command is useful to keep a folder on GDrive and somewhere else with identical contents - meaning that if the destination folder has files that do not exist on the source they will be removed (so be careful)
Let’s remove testfile.docx and sync our rclonefiles folder to our GDrive rclonetest folder
$ rm testfile.docx
$ rclone sync ~/rclonefiles rclone-gdrive:/rclonetest
We should see in GDrive that now only testfile2.docx is there because the folders are in sync - Mana’s rclonefiles folder was the source so the GDrive rclonetest folder is now identical to rclonefiles
RClone large transfer - use nohup
For transfers that make take a long time that you do not wish to observe or that your connection might disconnect you should use ‘nohup’ so they run in the background until complete. Example of nohup ‘rclone copy’ below:
$ nohup rclone copy source destination > nohup.out &
The ‘>’ after the destination will direct any standard output to be written to the nohup.out file and the ‘&’ on the end tells the shell to disconnect the command issued and run it in the background so you can still use your terminal/shell for other commands or exiting the session - the command issued with ‘nohup’ will continue to run.
More information about Rclone and Google Drive can be found here:
https://rclone.org/drive/#limitations
You can download for your machine here https://rclone.org/downloads/
Note - there is an experimental GUI for your laptop/workstation https://rclone.org/gui/
Key Points