I am looking for the best method for a windows computer to grab a directory listing, output the result to a formatted text file I can then use to make a SQL update.
Directories are formated:
/<Category-Name>/img.jpg
or
/<Category-Name>/images/*.jpg
/<Category-Name>/thumbnails/*.jpg
or
/<Category-Name>/full/*.jpg
/<Category-Name>/thumb/*.jpg
What I was considering is a output file containing:
<Category-Name>,f,blah1.jpg
<Category-Name>,f,blah2.jpg
<Category-Name>,t,blah3.jpg
etc...
My limitations are that I am not on, nor do I have access to a Linux computer for nifty tools such as cat. So I have decided C# and the .Net framework are my best bet to accomplish this. I believe Python or Perl would do just as well but I have yet to learn either language.
Any suggestions on how to write such a program or other ideas on how to tackle this are most welcome.
To be clear, my intentions are to get a directory listing with files all ending in ‘.jpg’ outputted to a text file in a way that I can manipulate to create an SQL INSERT into a database. Programming something to accomplish this would take considerably less time than making each entry through a Content Management system for this and future tasks. The directories are easily in the thousands.
DirectoryInfo should give you what you need — http://msdn.microsoft.com/en-us/library/system.io.directoryinfo.aspx