TraverseFolder of ExamineWeb.asp
in great detail. In this part, we are going to focus on the remainder of the code. As always, let's dive on
into the code!
|
We begin by declaring two variables, dtStartReport and dtStopReport. These two
variables will be used to determine the starting and stopping time of the report. Since the report may take
several seconds to run on large sites, noting the starting and stopping times serve as useful metrics.
Next we create two instances of the Dictionary objects, objDict and objSizeDict, which
will contain the number of files that fall under a particular file extension, and that group's associated
file size, respectively. We then create an instance of the FileSystemObject, which we'll use
to grab a folder object instance of the Web's root directory.
This is followed by determining whether or not the user wants to recurse the directories. We check to see
if a particular value is in the QueryString. If chkRecurse equals on, then
the user is interested in recursing the directories; else, the user doesn't want to recurse. Next we
obtain the physical path of the root Web directory using Server.MapPath. If you are unfamiliar
with Server.MapPath, be sure to read Using Server.MapPath.
Once we have the physical path of the root Web directory, we can use the GetFolder method of the
FileSystemObject to store the folder information in objFolder.
Finally we are ready to call TraverseFolder, passing in the root Web directory (objFolder),
the two empty dictionary objects (objDict and objSizeDict), and a boolean value
representing if we are interested in having the directories recursed or not (bolRecurseDirectories).
We end this section of code by setting dtStopReport to the current time. We're not quite completed
with ExamineWeb.asp. We still need to display the results of the report, generate the two bar graphs,
and provide drill down links to the DetailedReport.asp report! Quite a bit more, eh? We'll finish
off ExamineWeb.asp in Part 4.



