Consider using attachments for so big files of code. It would make it easier for most people to study it. I believe that you must isolate from the code, the part that does the recursive descent in the directory structure. Also how would the printing take place is important. Consider reading this: Tree traversal.
I would probably do it like:
Code:
Pseudocode:
SUB print_dir(String rootDir)
BEGIN
STATISTICS(rootDir)
IF (isDirectory(rootDir))
BEGIN
files = readFilesOf(rootDir);
FOREACH file IN files DO
BEGIN
print_dir(file)
END
END
END
However that method might not yield the results you would like.