Convert DBase files to SQLite create table/insert statements
I was given a bunch of ‘.dbf’ (Dbase III) files with data I needed. As I don’t have any old Dbase SW, I decided to transfer data to SQLite where I can join tables, clean data etc…
- Clone project
- Run
npm install - Run
node index.js -f <folder> -sand program will translate every.dbffile intoCREATE TABLE / INSERTstatements
-f <folder>source folder (all subfolders will be searched)-sfrom every.dbffile program will create corresponding.sqlfile-cencoding (if none is given, ‘utf8’ will be used)-eDBase extension (if none is given,.dbfis used)-bBatch size (number of rows processed in one loop), default = 1000-hHelp
DBFFile[https://github.com/paypac/DBFFile] _for reading Dbase filesiconv-lite[https://www.npmjs.com/package/iconv-lite] for character encodingsminimist[https://github.com/substack/minimist] for working with commandline arguments
// help
node src -h
// convert all .dbf files in c:\data folder to console
node src -f c:\data
// convert all .dbf files in c:\data folder to corresponding .SQL files
node src -f c:\data -s
// convert all .dbf files in c:\data folder
// to corresponding .SQL files
// using windows-1250 code page
node src -f c:\data -s -c win1250