
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!
Leave a comment