Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. #!/bin/bash
  2. # backup_dirs_to_tars.sh - back up directories in $backupdir to
  3. # individual tars in $outputdir
  4. # NB ignores .hidden (dotted) directories
  5.  
  6. backupdir=/home/n/usernamefolder/
  7. outputdir=/home/n/usernamefolder/backups
  8. declare -a arr=("backups/" "ignorefolder1.com/" "ignorefolder2.com/")
  9.  
  10.  
  11. cd $backupdir
  12.  
  13. for dir in */; do
  14.         if ! [[ ${arr[@]} =~ "$dir" ]]; then
  15.                 tar -cf "$outputdir/$(basename $dir).tar" "$dir"
  16.                 echo "OK $dir"
  17.         fi
  18. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement