Skip to content

Instantly share code, notes, and snippets.

@dgacitua
Created November 25, 2023 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgacitua/c322b04505f304bb06dce86a52e8d597 to your computer and use it in GitHub Desktop.
Save dgacitua/c322b04505f304bb06dce86a52e8d597 to your computer and use it in GitHub Desktop.
Bash script to backup a mounted external drive to local folder
#!/bin/bash
set -e
SOURCE="/media/dgacitua/DGACITUA-SSD/" # Mounted external drive path (including trailing slash)
DESTINATION="/home/dgacitua/rsync-backup" # Local folder where the data is copied (without trailing slash)
mkdir -p $DESTINATION
rsync -azuvhP --delete --exclude="node_modules" --iconv=. $SOURCE $DESTINATION # Making backup with RSync
set +e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment