: export-dbase.bat : batch file to populate a dBase (xBase) file via an MS-ACCESS database from a MySQL database : n6lhv@arrl.net : created: 24-December-2005 : updated: 3-April-2011 : functional dependencies : -the ODBC driver (e.g., MySQL Connector/ODBC) has been installed correctly : -the MySQL Service is running : -all of the correct database files have been successfully generated SET fileRoot=%1 : Make a duplicate copy of a (dynamic) table name to a (static) known table name mysql uls -e "DROP TABLE IF EXISTS tblDbaseNew;" mysql uls -e "CREATE TABLE tblDbaseNew SELECT * FROM %fileRoot%dbase;" : Rename the "location_county" field to the "loc_county" field (dBase 8 char. limitation) : (not needed anymore--is now done prior to this .bat file) :mysql -vvv qryGeoRenameField-dbase.log : (old) :mysql -vvv -e "SET @FileRoot:= '%fileRoot%';" qryGeoRenameField-dbase.log :SET @FrequencyBand := '025 - 050 MHz'; : (this works, but it doesn't really scale well....ws) IF %fileRoot%==tblGeoStateCA SET dbaseRoot=STATECA IF %fileRoot%==tblGeoCountiesSoCal SET dbaseRoot=COSOCAL :echo %dbaseRoot% :pause : (make sure this set of files are deleted) del i:\uls\master\dbase\%dbaseRoot%5.DBF del i:\uls\master\dbase\%dbaseRoot%4.DBF del i:\uls\master\dbase\%dbaseRoot%3.DBF : MS-Access (2003) database, structure and data for one (big) table del %fileRoot%-dbase5.zip del %fileRoot%-dbase4.zip del %fileRoot%-dbase3.zip del %fileRoot%-dbase.mdb copy %fileRoot%-dbase-empty.mdb %fileRoot%-dbase.mdb :"c:\program files\microsoft office\office11\msaccess.exe" i:\uls\master\%fileRoot%-dbase.mdb /x macUpdateExport "c:\program files\microsoft office\office14\msaccess.exe" i:\uls\master\%fileRoot%-dbase.mdb /x macUpdateExport : (we need a better method here) : (also, we need to unzip later to check the filesizes...ws) pkzip25 -add %fileRoot%-dbase5 i:\uls\master\dbase\%dbaseRoot%5.DBF pkzip25 -add %fileRoot%-dbase4 i:\uls\master\dbase\%dbaseRoot%4.DBF pkzip25 -add %fileRoot%-dbase3 i:\uls\master\dbase\%dbaseRoot%3.DBF del %fileRoot%-dbase.mdb : Delete the "temporary" (new) table mysql uls -e "DROP TABLE tblDbaseNew;" : Delete the "temporary" (copy) table :mysql uls -e "DROP TABLE tblDbaseCopy;"