Skip to content

Instantly share code, notes, and snippets.

@aquatix aquatix/tarball2git.sh
Last active Aug 29, 2015

Embed
What would you like to do?
Convert a directory with backup tarballs to a Git repository
#!/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
You can’t perform that action at this time.