#3 added regular expression before computing the checksum
#3 able to define pattern on the command line parameter
#2 correctly generates top root directory name in output file