Skip to content

Instantly share code, notes, and snippets.

@AggamR

AggamR/backup.sh

Created Mar 26, 2021
Embed
What would you like to do?
a script to automatically backup all files listed in the `/home/aggam/backups/foldersToBackup` file
#!/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