diff --git a/pym/cl_utils.py b/pym/cl_utils.py index 5df9da3..4a4c380 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -733,9 +733,16 @@ def checkDigestFile(digestfile): reEntry.findall(open(digestfile,'r').read()): if hasattr(hashlib,alg.lower()): hashobj = getattr(hashlib,alg.lower()) - filename = path.join(path.dirname(digestfile),filename) - if path.exists(filename): + filename = os.path.join(os.path.dirname(digestfile),filename) + if os.path.exists(filename): digest = hashobj(open(filename,'r').read()) result.append((alg, digest.hexdigest().upper() == hashdata.upper())) return result + +def getFilesCount(directory): + """Get files count from directory""" + if os.path.exists(directory): + return len(reduce(lambda x,y:x+y,map(lambda x:x[1]+x[2], + os.walk(directory)),[])) + return 0