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!
I'm an Australian Chief Analytics Officer passionate about data science, visual insights, and all things sport—particularly cricket. An adventurer at heart, I’ve gone from abseiling cliffs to snorkeling in crystal-clear waters, sleeping in the wilds of Africa, and exploring destinations worldwide, with my latest trip taking me to Bali. When I'm not diving into data or analytics, I'm spending time with my three sons and two daughters, attempting to hit sixes for my local cricket club, reviewing chicken schnitzels or honing my craft around a coffee machine.