31 lines
699 B
Bash
31 lines
699 B
Bash
#!/bin/bash
|
|
|
|
IFS=$'\r\n' GLOBIGNORE='*' command eval 'FILES=($(cat backup_filelist.txt))'
|
|
|
|
for i in "${FILES[@]}"
|
|
do
|
|
FILENAME=$(basename "$i")
|
|
if [ -f "$FILENAME" ]; then
|
|
#echo "$FILENAME exists."
|
|
DIF=$(diff "$i" "$FILENAME")
|
|
if [ -z "$DIF" ]
|
|
then
|
|
#echo "$FILENAME has not changed, skipping."
|
|
else
|
|
#echo "$FILENAME has changed, copying..."
|
|
cp "$i" .
|
|
fi
|
|
else
|
|
#echo "$FILENAME does not exist, copying..."
|
|
cp "$i" .
|
|
fi
|
|
done
|
|
|
|
if [[ `git status --porcelain` ]]; then
|
|
#echo "Git reports changes. Perfoming next generic commit."
|
|
git add *
|
|
git commit -m "next commit"
|
|
else
|
|
#echo "Git doesn't report any changes. No new commit. Exiting."
|
|
fi
|