Extract the if statement in localMD5listing into a method recurseMD5
that takes a File argument and the list of hashes for update. Then start off the process by calling
recurseMD5(baseModDirectoryFile, localmd5List);
and in recurseMD5
you just recurse on all listFiles() when the parameter is a directory. If, OTOH, it is a regular file, you add the md5.
void recurseMD5(File it, List<String> hashes) {
if (it.isDirectory) {
for (File f : it.listFiles()) recurseMD5(f, hahses);
}
else {
// process MD5 hash of file
}
}