The Ol DOS Prompt

Create CSV from file names in Windows folder

I have several hundred files in a windows directory that I need to get into a CSV list for import into a SQL table. This is a quick and dirty way to create a flat file with just the file names:

Run that from a command prompt having navigated to the folder in question to generate your file. To return the complete path of the file:

You can drop the switches to get all the information the dir command returns.

DTS/SSIS/BCP this file into SQL and away you go. Hope this helps!

Share on Google Plus


Australian. Sport. Passionate Cricket Fan. Go Pro. Abseiling. Snorkeling. Travel. Golf R. SQL Server Developer. Three sons. One daughter. Last Trip: Tasmania.

Leave a comment

Your email address will not be published. Required fields are marked *