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:
However that method might not yield the results you would like.
SUB print_dir(String rootDir)
files = readFilesOf(rootDir);
FOREACH file IN files DO