Created
March 26, 2021 15:04
-
-
Save AggamR/49161e8e8c297b8d07cbbd75e0df0fba to your computer and use it in GitHub Desktop.
a script to automatically backup all files listed in the `/home/aggam/backups/foldersToBackup` file
This file contains 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 | |
[ -d /home/aggam/backups/folders$(date '+%d%B%Y') ] && rm -rf /home/aggam/backups/folders$(date '+%d%B%Y') | |
while read p; do | |
echo $p | |
mkdir /home/aggam/backups/folders$(date '+%d%B%Y') | |
cp -r $p /home/aggam/backups/folders$(date '+%d%B%Y') | |
done </home/aggam/backups/foldersToBackup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment