A streaming, low-memory CLI that converts dBASE / FoxPro DBF files to CSV.
It reads the DBF format directly. It does not use VFPOLEDB or any OLE DB provider. Index files (.cdx, .idx) are ignored. FoxPro memo files (.fpt) are opened only when a table has memo fields.
- .NET 10 SDK to build
- A published
dbf2csv.exedoes not require .NET on the target machine
dotnet run --project src/Dbf2Csv -- customer.dbf -o customer.csvPublish a standalone Windows executable (self-contained single file):
dotnet publish src/Dbf2Csv -c Release -r win-x64 -o publishThe output is publish/dbf2csv.exe. Other runtimes use the same command with a different -r (win-arm64, linux-x64, osx-arm64).
The published command name is dbf2csv.
dbf2csv <inputs...> [-o|--output <path>] [--encoding <name>] [--delimiter <char>] [--include-deleted] [--null <text>]
| Option | Default | Description |
|---|---|---|
inputs |
required | One or more .dbf files or globs (customer.dbf, *.dbf). Globs are expanded by the tool so they work in PowerShell and cmd. |
-o, --output |
{name}.csv in the current directory |
Single input: a CSV file path or a directory. Multiple inputs: a directory. Each input name.dbf becomes name.csv. |
--encoding |
DBF language-driver byte, else windows-1252 |
Encoding used to decode character and memo fields. Output CSV is always UTF-8 (no BOM). |
--delimiter |
, |
CSV field separator. Use a single character, or \t for tab. |
--include-deleted |
off | Include records whose deletion flag is *. Deleted records are skipped by default. |
--null |
empty string | Token written for blank numeric, date, logical (?), and empty memo fields. |
Exit code 0 means every file converted. A missing file, unreadable header, missing .fpt for memo fields, or -o file used with multiple inputs returns 1.
dbf2csv customer.dbf -o E:\exports\customer.csv
dbf2csv *.dbf -o E:\exports
dbf2csv customer.dbf --encoding windows-1252
dbf2csv customer.dbf --delimiter ","
dbf2csv customer.dbf --include-deleted
dbf2csv customer.dbf --null ""Progress is printed per file:
customer.dbf -> E:\exports\customer.csv (1234 rows)
| Signature | Format |
|---|---|
0x03 |
FoxBASE+ / dBASE III PLUS, no memo |
0x83 |
FoxBASE+ / dBASE III PLUS, with memo |
0x8B |
dBASE IV with memo |
0x30 / 0x31 / 0x32 |
Visual FoxPro |
0xF5 |
FoxPro 2.x with memo |
Unknown signatures fail with the hex value.
| Type | CSV value |
|---|---|
C |
Character, trailing spaces trimmed |
V |
Visual FoxPro varchar |
N / F |
Numeric / float as stored (padding removed) |
I |
32-bit integer |
B |
IEEE double |
Y |
Currency (integer / 10000) |
L |
true / false |
D |
yyyy-MM-dd |
T |
yyyy-MM-ddTHH:mm:ss |
M |
FoxPro FPT text memo (4-byte binary or 10-byte ASCII block pointer) |
0 |
VFP null-flags column; used to mark other fields null, not written to CSV |
Blank numeric/date values, ? logicals, and memo pointer 0 use the --null token. Character fields that are only spaces become an empty string (unless a VFP null flag marks them null).
CSV values that contain the delimiter, ", or a newline are quoted per RFC 4180.
.fptis required when the table has memo / general / picture / blob fields (M,G,P,W). The expected path is the DBF path with a.fptextension. If that file is missing, conversion fails with the expected path.- Text memos (FPT type 1) are decoded with the same encoding as character fields. Non-text memo blocks are written as null.
- dBASE
.dbtmemo files are not supported. .cdxand.idxfiles are ignored.
dotnet test