Create CSV from file names in Windows folder

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:

dir /b > mycsv.txt

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:

dir /b /s > mycsv.txt

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!

Mike250

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

Related Posts
Leave a comment

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