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> -s
and program will translate every.dbf
file intoCREATE TABLE / INSERT
statements
-f <folder>
source folder (all subfolders will be searched)-s
from every.dbf
file program will create corresponding.sql
file-c
encoding (if none is given, ‘utf8’ will be used)-e
DBase extension (if none is given,.dbf
is used)-b
Batch size (number of rows processed in one loop), default = 1000-h
Help
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