views:

192

answers:

2

Does anybody know what I could use to write a script to convert all MDB files in a directory to CSV files? I'm working on Windows but have been using Cygwin for some work.

A: 

I don't know of a script to do it, but a pretty easy way (unless you have a lot of MDB's) is to open up the MDB and save each table to CSV directly.

Jon
A: 

I presume you mean that you want to write each relevant table in every mdb file to a CSV file? Here is a possible structure for doing this.

Loop1 -- find all mdb files
  Connect to access database
  Loop2 -- loop round all the tables you are interested in
      Wrie output to CSV file
  End Loop2
End Loop1

You could look at the export facilities within MS Access and automate these using VBA. This works quite well except that the CSV files are sometimes messed up by white space e.g. carriage returns embedded within table fields.

If you are familiar with perl then this could be an answer.

heferav