rmcp uses the scp command to backup reMarkable files and directories by date over either USB or WLAN. It is written in Bash for a Linux machine, and, while it may work on MacOS, it most likely will not on Windows.
- Note:
- This script was made to replace the
rmcpalias in the previous article, remember to remove it from your.bash_aliasesfile.
Backups by date over USB and WLAN
rmcp first creates a directory called unremarkable and a subdirectory, remarkable_backups, to store backups by date, after creating these directories it prompts the user for their tablet's IP address.
rmcp checks that the IP format is correct, and, if it isn't, prompts the user again. If it is, then rmcp creates the backup directory and attemps to copy files from the table with the scp commmand either over USB, if the IP address is 10.11.99.1, or WLAN otherwise.
- Note:
- If you have many files on your tablet it is at least 5 to 10 times faster to backup over USB.
Code listing
#!/bin/bash
if [[ ! -e ~/unremarkable ]]; then
mkdir ~/unremarkable
fi
if [[ ! -e ~/unremarkable/remarkable_backups; then
mkdir ~/unremarkable/remarkable_backups
fi
BACKUP_DIR=~/unremarkable/remarkable_backups/backup-$(date -I)
REMARKABLE_DIR=/home/root/.local/share/remarkable/xochitl
# Prompt user for tablets IP address, if the format is incorrect, try again.
while true; do
read -p 'What is your reMarkable tablet'\''s IP? ' REMARKABLE_IP;
if [[ ! $REMARKABLE_IP =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
echo 'Incorrect IP format.'
echo 'Enter an address in the format x.x.x.x'
echo '(where x is a one, two or three digit number).'
elif [[ $REMARKABLE_IP == '10.11.99.1' ]]; then
echo 'IP format OK. Attempting to connect via USB.'
break
else
echo 'IP format OK. Attempting to connect over WLAN.'
break
fi
done
echo 'Creating backup directory'
mkdir $BACKUP_DIR
echo 'Backing up files'
scp -r root@$REMARKABLE_IP:$REMARKABLE_DIR/* $BACKUP_DIR
echo 'End of Program!'