-
Download and install rclone to your $HOME/bin directory. Setup up rclone to connect to your google drive. Suppose you call your remote google drive
drive. -
Create a bash script called
backup_gdrive.shwith the following information
#!/bin/sh
STUDY_DIR=STUDY
LOCAL_DIR=${SCRATCH}/${STUDY_DIR}
GDRIVE_DIR=Data/${STUDY_DIR}/derivatives/
## Replace `drive` with whatever you call your remote backup volume in rclone.
rclone sync --copy-links --update ${LOCAL_DIR} drive:${GDRIVE_DIR}
## Uncomment and use copy instead of sync if you don't want files on google drive to be overwritten.
# rclone copy --copy-links --update ${LOCAL_DIR} drive:${GDRIVE_DIR}
## Using checksum slows down the operation as it is intensive to use checksum to compare if the local and remote files are identical
# rclone copy --checksum --update ${LOCAL_DIR} drive:${GDRIVE_DIR}- Now submit a backup job to slurm using
sbatch -t 4:00:00 -p owners backup_gdrive.sh