Last active
August 29, 2015 13:58
-
-
Save aquatix/10249476 to your computer and use it in GitHub Desktop.
Convert a directory with backup tarballs to a Git repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Missing source directory (dir with the tarballs)" | |
echo "usage:" | |
echo " tarball2git.sh <backupdir> <gitrepo>" | |
elif [ -z "$2" ]; then | |
echo "Missing git repository directory" | |
echo "usage:" | |
echo " tarball2git.sh <backupdir> <gitrepo>" | |
else | |
for FILE in `ls -1 $1`; do | |
#echo $FILE | |
echo "./$1/$FILE" | |
echo "$2/$FILE" | |
cp -a "$1/$FILE" $2 | |
cd $2 | |
tar xf "$FILE" | |
rm "$FILE" | |
git add -A | |
git commit -am "$FILE" | |
cd - | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment