Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, sys, hashlib
- def main():
- thisdir = os.listdir(os.getcwd())
- thisfile = os.path.split(sys.argv[0])[1]
- files = [i for i in thisdir if i != thisfile]
- for file in files:
- filehash = hashlib.md5(open(file, "rb").read()).hexdigest()
- extension = os.path.splitext(file)[1]
- os.rename(file, filehash+extension)
- del(filehash)
- del(extension) #memory
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement