June 26, 2000
By Karen Kenworthy
IN THIS ISSUE
Ahem. I think you should know, you're talking to the "Most School Spirited" of the Thomas Alva Edison High School Class of 1970. I've got the certificate to prove it, right here beside me. I also have a beautiful silver box, given to me by the reunion committee, for my work on the class Web site. You could say I had a very nice reunion.
But even nicer were the wonderful conversations with dozens of former classmates, some of whom I've known since elementary school. If you get a chance to renew old acquaintances, don't pass it by. It's true what they say: "You can always make new friends. But you can't make more old friends. So keep the ones you have."
Directory Printer
Despite all the excitement of the last few days, I haven't forgotten our journey through the Setup Swamp. In fact, even now we're sneaking up on one of the biggest alligators in the swamp. So be careful. I don't want him to know we're on to him ...
But today I want to spend some time on dry land. I've spent time recently, enhancing one of the most popular of our Power Tools, the Directory Printer. Well this week I taught the Directory Printer how to print the number of files it finds in each folder or directory. It can also print the total size of those files, showing how much disk space a folder's files occupy.
For some time this has been one of the most often requested enhancements to the Directory Printer. All of us have obsolete and unneeded files on our disk drives. And some of us have whole disk folders full of such files. Even with today's huge drives, it's sometimes necessary to do a little housekeeping and remove recover the wasted space. Identifying which folders are bloated, and which are so small they aren't worth examining, is a good first step. And of course, the Directory Printer has always helped us with the second step -- showing how much space each file uses.
Now you might think printing file counts, and total file sizes, would be a simple enhancement. And in a way it was. Internally, where all the thinking occurs, the program simply sets aside two small chunks of your computer's RAM, or variables, for each disk folder it finds.
When it encounters a file, it adds 1 to one of the variables belonging to the file's folder. It then adds the file's size to the folder's other variable. When all the files in a folder have been processed, that folder's variables hold the number of files found, and their total size. All wrapped up nice and neat, and ready to print.
Upside Down
The problem is, this little bundle of data isn't available for printing until after the name of the directory, and the information about each of its files, have been printed. This means the new Directory Printer displays directory totals at the end of each directory's list of files, not the beginning as most people would prefer.
The only solution is to scan all the files in a folder first, counting its files, and computing the total size of its files. Then, a program could print the name of the folder and its statistics first, followed by one line of information about each of the folder's files.
Now you may be asking, "Karen, why not do it that way?" All it takes is a little time and a little RAM. And we all have plenty of both. Unfortunately, the price is higher that at first it seems. That's because folders are more than collections of files. Folders can contain other folders too.
To see how this matters, let's ask a program to determine the number of files found in a disk's root directory, and in all other folders found on a drive. In other words, let's ask the program to print a drive's directory tree, beginning at C:\.
To compute the statistics of the root directory, the program must count the number of files in the root directory itself, and count all files found in each of folders the root directory contains. It must then examine each of those folders, looking for folders they might contain. The process continues, examining folders within folders (subdirectories within subdirectories), until all folders and files on the entire drive have been found and tallied. The program is now ready to print the first line of its report: statistics pertaining to the root directory.
Now the program must select one of the root directory's folders and repeat the process. It must count that folders files, and the files the folders that folder contains. When all is said and done, some folders may have their files counted several times. A file residing at C:\folder1\folder2\folder3, for example, must be counted when information is printed about folder 1, again when printing information about folder 2, and once more when printing information about folder3. That's because it resides, at different depths, in all three folders.
All this "directory traversal" takes a lot of time. As a result, a program that worked this way would have to think for several seconds, perhaps as long as a couple of minutes, before printing a single line. In most cases, we want our information sooner than that.
If Windows could provide information about directories, and not just files, programs like Directory Printer would be easier to write. But as long as the program itself must accumulate directory statistics the program I just mentioned will remain. That doesn't mean, however, there aren't improvements that can be made. And I'm working on one for a future version of the Directory Printer. With some luck, it will be available in a few weeks.
But in the meantime, if you'd like to give the new Directory Printer v2.8 a try, download a free copy at https://www.karenware.com/powertools/ptdirprn. While there, help yourself to the program's free Visual Basic source code too.
File Types
As you may recall, the Directory Printer recently learned how to highlight various types of "executable" files. These files can, if designed maliciously, do harm to your computer when opened. On the other hand, they are also responsible for every good thing accomplished by computers, since all programs are "executable."
Originally, the Directory Printer obtained its list of executable file types from Microsoft, using the list of potentially "unsafe" files blocked by the new Outlook Security Update. Later, I added several types of executable files that Microsoft overlooked.
But even this list is not complete, and several of you responded to my call for additions to the list. Reader Tim McGowan wrote to tell me "WordPerfect for Windows uses .wpm for its macro file extensions. WP's implementation is, of course, much more safe [than Microsoft's macro language], but it's a very powerful language nonetheless." Tim also alerted me to the potential danger of .wpt files, those that contain WordPerfect document templates.
Reader Bob Dietz suggested two more additions to the list, .wll (Microsoft Word add-in) and .xll (Microsoft Excel add-in). And right on his heals was reader Dan DeYoung, who pointed out .mht files, single-file Web archives that can be created by Microsoft Internet Explorer version 5.0 and later.
These file types have been added to the latest version of Directory Printer. And I've also added them to our online list of file types you can see at https://www.karenware.com/powertools/filetypes. Check it out and let me know what you think. If you know of any other types of files that should be added to the list, drop me a note at karenk@karenware.com.
And as always, look for me on the Net this week. If you see me, be sure to wave and say "Hi!" and I'll keep an eye out for you too. And don't forget to dig out your hip waders and get them ready. We'll be back in the Setup Swamp before you know it!
More than 6000 downloads monthly
Received $184.68 this month* — Thanks!
License for Work
A license is required to use any or all of these tools for your work. You only need one per lifetime. If you make money with Karen's software, read her license agreement.
Power Tools Newsletter
- What is Karen's QR Code Talker?
- What is a QR code?
- What is a Code Talker?
24836 Verified Subscribers
Subscribe to receive new issues of the newsletter about Karen and her free Power Tools.
Click here to SubscribeNovember Revenue* $184.68
*Licenses + Donations - PayPal Fees
Oct $211 Sep $166 Aug $173 Jul $225 Jun $324 May $200 Apr $700 Mar $273 Feb $405 Jan $56 (2023) Dec $349 Nov $546 Oct $253 Sep $232 Aug $189 Jul $379 Jun $188 May $484 Apr $212 Mar $519 Feb $89 Jan $462 (2022) Dec $1088 Nov $151 Oct $133 USD — Thanks again!