File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -466,11 +466,15 @@ if [ "$USER" != '*' ]; then
466466 fi
467467 fargs=()
468468 for xpath in $( echo " $USER " | tr ' ,' ' \n' ) ; do
469- fargs+=(-not)
470- fargs+=(-path)
471- fargs+=(" ./$xpath *" )
472- echo " $( date " +%F %T" ) excluding directory $xpath " | \
469+ if [ -d " $xpath " ]; then
470+ fargs+=(--exclude=$xpath /* )
471+ echo " $( date " +%F %T" ) excluding directory $xpath " | \
473472 tee -a $BACKUP /$user .log
473+ else
474+ echo " $( date " +%F %T" ) excluding file $xpath " | \
475+ tee -a $BACKUP /$user .log
476+ fargs+=(--exclude=$xpath )
477+ fi
474478 done
475479
476480 IFS=$' \n '
@@ -487,7 +491,7 @@ if [ "$USER" != '*' ]; then
487491 check_backup_conditions
488492
489493 # Backup files and dirs
490- tar -cpf- $udir | gzip -$BACKUP_GZIP - > $tmpdir /user_dir/$udir .tar.gz
494+ tar --anchored - cpf- ${fargs[@]} $udir | gzip -$BACKUP_GZIP - > $tmpdir /user_dir/$udir .tar.gz
491495 fi
492496 done
493497 set +f
You can’t perform that action at this time.
0 commit comments