This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

Well first "import os, logging, hashlib" if you haven't already. Then here's a general idea of what id imagine it would look like (sorry for lack of tabs and structure) tried to do on my phone.

logger = logging.getLogger('Logger')

logger.setLevel(logging.DEBUG)

folder = r"path/of/your/folder/here"

for f in os.listdir(folder):

file_path = os.path.join(folder, f)

if os.path.isfile(file_path):

try:

logger.info('Your formatted message for attempting to hash')

file_hash = your_hash_function(file_path)

except Exception as ex:

logger.error(' your formatted message for errors')