I use this to backup important files to a second drive.
I forgot where I saw it, but some people backup /home/johndoe
If I did back that up, would that help me if I had to reinstall my operating system?
I use Ubuntu.
#!/bin/bash
#
# BACKUP IMPORTANT FILES TO MAXTOR DRIVE
#
# Don't use ALLCAPS for variable names or begin them with a number.
#
DOG_ATTACKS="home/andy/Dog_Attack/"
Backup_Directory="/media/andy/Maxtor/Backup/Ubuntu_Mate_24.04/"
DOCS="/home/andy/Documents/" # shell variable
SCRIPTS="/home/andy/bin/"
HOME="/home/andy/"
ICONS="/home/andy/Icons"
MY_Sounds="/usr/share/sounds/My_Sounds/"
THUNAR="/home/andy/.config/Thunar/"
Music="/home/andy/Music/"
FedEx="/home/andy/FedEx/"
#
cd $THUNAR
tar -cf Thunar_Custom_Actions.tar uca.xml
/usr/bin/rsync --progress -r -u Thunar_Custom_Actions.tar $Backup_Directory
#--------------------------------
cd /home/andy/Dog_Attack/
tar -cf Dog_Attack_Documentation.tar *.png *.pdf *.odt *.jpg *.mp4
/usr/bin/rsync --progress -r -u Dog_Attack_Documentation.tar $Backup_Directory
#-----------------------------------------------
#
cd $DOCS
tar -cf Ubuntu_Documents.tar *.txt *.doc *.rtf *.html *.png *.pdf *.odt *.ods *.odg *.csv *.xls *.jpg *.PDF *.docx *.otg
## ONLY copy file if it's newer than destination file
##
/usr/bin/rsync --progress -r -u Ubuntu_Documents.tar $Backup_Directory
#-----------------------------------------------
cd $SCRIPTS
tar -cvf UM_24_04_Ubuntu_Scripts.tar *.sh *.txt
/usr/bin/rsync --progress -r -u UM_24_04_Ubuntu_Scripts.tar $Backup_Directory
#
# Backup Firefox bookmarks.
#
# Backup my music
/usr/bin/rsync --progress -r -u /home/andy/.mozilla/firefox/t0kduppg.default-release/bookmarks.html $Backup_Directory
#
cd $Music
tar -cvf My_Music.tar *.mp3
/usr/bin/rsync --progress -r -u My_Music.tar $Backup_Directory
#
cd $FedEx
tar -cvf FedEx_Documentation.tar *.png $Backup_Directory
/usr/bin/rsync --progress -r -u FedEx_Documentation.tar $Backup_Directory
#
#date +'%m/%d/%Y %I:%M:%S %p' > /home/andy/Downloads/Computer_Backup.txt
gxmessage -fg blue -font 'sans 20' -timeout 2 'Computer has been backed up'