Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # backup_dirs_to_tars.sh - back up directories in $backupdir to
- # individual tars in $outputdir
- # NB ignores .hidden (dotted) directories
- backupdir=/home/n/usernamefolder/
- outputdir=/home/n/usernamefolder/backups
- declare -a arr=("backups/" "ignorefolder1.com/" "ignorefolder2.com/")
- cd $backupdir
- for dir in */; do
- if ! [[ ${arr[@]} =~ "$dir" ]]; then
- tar -cf "$outputdir/$(basename $dir).tar" "$dir"
- echo "OK $dir"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement