Using Rclone to sync data.
In this example we use:
- Rclone over SFTP.
- User SSH password.
Install Rclone on Debian and Ubuntu.
sudo apt install rclone
Install Rclone on Windows and other Systems.
Go to https://rclone.org/downloads/
Create a New Remote, run rclone config.
Choose option 26 for SSH.
Enter Hostname or IP.
Enter your username.
Enter for default port 22.
y to enter your password.
Enter your password.
Enter for the default value.
n to leave optional password blank.
Enter for the default ("false").
Enter for the default ("false") twice.
n for advanced config.
y to confirm settings.
New "remote" is now created.
q to quit.
Listing files and directories on remote
List directories in the home directory
rclone lsd extralayer:
-R flag to list directories and sub-directories recursively.
rclone lsd -R extralayer:
List files in the home directory
rclone ls extralayer:
List directories and files in the home directory
rclone lsf extralayer:
List directories and files recursively.
rclone lsf -R extralayer:disks
Use Rclone to sync data
Clone a local directory named disks to a remote directory named disks.
rclone sync disks/ extralayer:disks/ -P
-P shows progress.
The command will sync everything from local to remote. If data is added or deleted locally Rclone will sync the changes to remote when you run
rclone sync again.
If the directory of the same name already exists on remote then Rclone will remove the files from remote directory that do not exist on local and upload the existing local files to remote, so make sure you don't overwrite something you don't want to overwrite accidentally.
--dry-run flag beforehand to prevet data loss.
Message "Not deleting as dry run is set" will display.