As seen above, this script will save to a file (c:\directory_list_mmddyyyy.txt) a listing of a folder of your choice. It first saves the date and time the script was run, followed by the script's name, and your selection. Starting with the main folder, it saves the folder name, size, and the date created. Next, it goes through the folder saving the file name, size, date created, and the comments, if any. (The comments are those shown when a file is right-clicked and the Summary tab is selected.). But it doesn't stop there. It continues through sub-folders, sub-sub-folders, etc., and files until done. So what? Well, you may have several folders and hundreds of files with short descriptions. When you run this script, you'll probably find that several of them, even though they have different names, share the same information. Also, entering the saved file into a database will broaden your choice of keywords. Note: The output is delimited with tabs, but due to different file name lengths, file size, and comments, it will require some minor housecleaning.
I used AutoItV3 to write my first version of PrintDirectory. AutoIt is an easy and flexible keyboard macro generator. I then started reading about VBScript, of which I had no knowledge. I used Microsoft's VBScript Reference Guide and Do-It-Yourself Script Center to become self-taught. I knew what to write, but not how. I used different modules. I tested (using the Script Debugger IDE and ConTEXT), reviewed variables, deleted and added code, then retested each one until they worked independently. Now, I had to put them together and here is the final product.
Using the code
Double-click on PrintDirectory.zip and extract the file anywhere you want, preferably the root directory. When you double-click on PrintDirectory.vbs a standard listbox appears. Click on the folder you want it saved and select OK. The next step has two options. Press '1' (the default) and 'enter', and the output will be saved as shown above (pressing 'enter' alone will produce the same output) . Press '2' and 'enter' if you want the folder name to be saved between the file name and the size. That's it. <!--
PrintDirectory.rtf is PrintDirectory.vbs in rtf format.
If you want to change the output name look for strDataFile at the beginning.
At the end of the file there's documentation on how to add and/or delete file properties from the output.
I know that I've made over a hundred changes since I started. I finalized my numbering system to the following: pd_mmddyyyy_hhmmss.vbs. Its self-explanatory. I've made two changes since July 2006. The first was to get the file size from another source, which is more accurate. The last change I made was to automatically save the extended file properties to an array (
References and Software used
I used OpenOffice.org to write the RTF file, AceHTML to convert it to HTML, ScreenGrabPro to get the screenshot, ConTEXT to test and run PrintDirectory.vbs
, and PowerArchiver to zip everything together. All freeware.
- ConTEXT - freeware text editor
- MSDN Library
Samples, reference guide, articles, tools, etc.
- Windows Script 5.6 for Windows XP and Windows 2000
This download installs Microsoft® Windows® Script containing Visual Basic® Script Edition (VBScript) Version 5.6, JScript® Version 5.6, Windows Script Components, Windows Script Host 5.6, and Windows Script Runtime Version 5.6.
- Microsoft Download Center
This link will install almost 2,000 scripts with descriptions, requirements, and search capability.
The Do-It-Yourself Script Center Kit includes all the materials you need to create your own version of the TechNet Script Center, either as stand-alone Web pages, stand-alone .vbs files, or as a .chm Help file. Included in the kit are a database of all the scripts found in the TechNet Script Center Script Repository, as well as helper scripts for creating Web pages, .vbs files, and .chm files. The kit also includes instructions for using these helper scripts.
- Script Debugger IDE (Shareware)
I had a bug that I couldn't find. I used this software and immediately found that the file location was missing from a variable.
- The Snippet Bank (Freeware)
A simple but efficient code snippet database with search, query, search and replace, unlimited categories, list view, and export to clipboard functions.