Chdir bug

This commit is contained in:
斟酌 鵬兄 2014-04-20 14:19:57 -05:00
parent 9d0654d604
commit a23d2b7815

View File

@ -48,10 +48,16 @@ while read line; do
# exclude file
EXCLUDE="exclude/${ARGS[1]}"
CHDIR=$(dirname $FILE)
if [ -d $FILE ]; then
CHDIR="$FILE/../"
fi
if [ -f $EXCLUDE ]; then
tar zcf "$BAKDIR/$BACKUPFILE" -C "$FILE/../" $FILENAME -X $EXCLUDE
tar zcf "$BAKDIR/$BACKUPFILE" -C $CHDIR $FILENAME -X $EXCLUDE
else
tar zcf "$BAKDIR/$BACKUPFILE" -C "$FILE/../" $FILENAME
tar zcf "$BAKDIR/$BACKUPFILE" -C $CHDIR $FILENAME
fi
# count backup file