for path, dirs, files in os.walk(dir_path):
    for file in sorted(files):
        hashes.append(sha1OfFile(os.path.join(path, file)))
for dir in sorted(dirs):
    hashes.append(hash_dir(os.path.join(path, dir)))
break
return str(hash(''.join(hashes)))
Создание уникального хэша для каталога в python