|
#!/usr/bin/python
#Filename:md.py
import os
import hashlib
class dir_file:
def file_md5(self,value):
if os.path.isfile(value):
m=hashlib.md5(value)
print value,"=>",m.hexdigest()
def scan_dir(self,value):
for file in os.listdir(value):
print "[",file,"]",">>",os.path.join(value)
show=dir_file()
value=raw_input("Input a path->")
if os.path.isdir(value):
show.scan_dir(value)
elif os.path.isfile(value):
show.file_md5(value) |
|