Created
May 2, 2019 18:43
-
-
Save geoffreygarrett/29c7f64f423df5b8153735f3ee0bcbf8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE="$(date +%d-%b-%Y)" | |
USER="$(id -u -n)" | |
BACKUP_PATH="/media/${USER}/$1/Ubuntu_Backup-$DATE" | |
# Define folders to backup from home. | |
declare -a arr=("Documents" "Desktop" "Picture" "PycharmProjects" "Repositories" "InspiringCodeSnippets" "University") | |
function backup_folder() { | |
echo "Backing up $1..." | |
cp -r "/home/${USER}/$1" "${BACKUP_PATH}" | |
} | |
# Iterate through all folders to backup. | |
for i in "${arr[@]}" | |
do | |
backup_folder $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment