Created
April 3, 2020 13:30
-
-
Save ToX82/051508a7cf15c82b9bcbe02524bd83a0 to your computer and use it in GitHub Desktop.
A quick script that converts a Ms Access database to sql insert files
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 "You need to specify the database file. Eg.: ./access_dump.sh my-database.mdb" | |
echo "" | |
echo "Please make sure that you have mdbtools installed on your system: 'sudo apt install mdbtools'" | |
exit 1 | |
fi | |
DB="$1" | |
TABLES="$(mdb-tables $DB)" | |
TABLES=$(echo $TABLES | tr " " "\n") | |
for TABLE in $TABLES | |
do | |
echo "Exporting table: $TABLE" | |
$(mdb-export -I mysql $DB $TABLE > $TABLE.sql) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment