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.
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.
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.
Iterate over all mdb files using perl's File::Find module
Connect to ms-access database as described here (http://stackoverflow.com/questions/1651585/how-do-i-connect-to-an-ms-access-database-using-perl)
- Generate csv files using perl's Text::CSV module