John Watson

The Pragmatic Enthusiast

  Home  |   Contact  |   Syndication    |   Login
  77 Posts | 0 Stories | 15 Comments | 71 Trackbacks

News

Tag Cloud


Archives

Post Categories

Favorite Tools

I've hacked together a little VBScript utility that will generate an Xml representation of a directory structure which you can download here. I looked around for something that already did this and came across Pat Coleman's DIR2XML utility. It provided a basis for what I needed but there were a couple of things I had to tweak - it generated a "flat" listing of all files and it produced an XHTML document via an XSL transform. Pat did a lot of the heavy lifting with the recursive directory scanning and getting file version information.

My bldDirXml.vbs does the following:

  1. Generates a nested Xml containing <folder> and <file> tags.
  2. Supports a "flattened" mode [-f] which pulls the information up into attributes of the folder or file tag instead of child elements.
  3. Generates a unique id for each folder and file.

To run it, use the following command: cscript bldDirXml.vbs "folderPath" [outputFilename] [-f]

All the usual disclaimers apply - it's a pretty brute force approach, not heavily tested, your mileage may vary, hold your nose if you look at the code, etc.

Enjoy!

posted on Friday, October 27, 2006 8:34 AM