import os, time, hashlib from stat import * def scan (path) : names = os.listdir (path) names.sort () for name in names : full_name = os.path.join (path, name) if os.path.isfile (full_name) : info = os.stat (full_name) size = info [ST_SIZE] t1 = info [ST_MTIME] # t2 = time.gmtime (t1) t2 = time.localtime (t1) t3 = time.strftime ("%Y-%m-%d:%H:%M:%S", t2) m = hashlib.md5 () # m = hashlib.sha512 () f = open (full_name, "rb") while True : data = f.read (32*1024) if not data : break; m.update (data) crc = m.hexdigest () print (name, size, t3, crc) scan (".") S osetrenim chyb import os, time, hashlib from stat import * def simple_scan (path) : names = os.listdir (path) names.sort () for name in names : full_name = os.path.join (path, name) if os.path.isdir (full_name) : scan (full_name) else : info = os.stat (full_name) size = info [ST_SIZE] t1 = info [ST_MTIME] # t2 = time.gmtime (t1) t2 = time.localtime (t1) t3 = time.strftime ("%Y-%m-%d:%H:%M:%S", t2) m = hashlib.md5 () # m = hashlib.sha512 () f = open (full_name, "rb") while True : data = f.read (32*1024) if not data : break m.update (data) crc = m.hexdigest () # print (full_name, size, t3, crc) print (full_name) def scan (path) : try : simple_scan (path) except PermissionError as e : print ("Not accessible", path, "(", e, ")") except Exception as e : print ("Another Error in", path, "(", type (e), str (e), ")") scan ("/var") Qt strom import os, time, hashlib from stat import * import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * class Window (QMainWindow) : def __init__ (self) : super().__init__ () self.setFont (QFont ("", 20)) self.tree = QTreeWidget (self) self.tree.setHeaderLabels (["name", "size", "time", "crc"]) self.setCentralWidget (self.tree) def simple_scan (self, target, path) : names = os.listdir (path) names.sort () for name in names : full_name = os.path.join (path, name) node = QTreeWidgetItem (target) node.setText (0, name) node.setToolTip (0, full_name) if os.path.isdir (full_name) : node.setForeground (0, QColor ("red")) self.scan (node, full_name) else : node.setForeground (0, QColor ("blue")) info = os.stat (full_name) size = info [ST_SIZE] node.setText (1, str (size)) t1 = info [ST_MTIME] # t2 = time.gmtime (t1) t2 = time.localtime (t1) t3 = time.strftime ("%Y-%m-%d:%H:%M:%S", t2) node.setText (2, t3) m = hashlib.md5 () # m = hashlib.sha512 () f = open (full_name, "rb") while True : data = f.read (32*1024) if not data : break m.update (data) crc = m.hexdigest () node.setText (3, crc) # print (full_name, size, t3, crc) # print (full_name) def scan (self, target, path) : try : self.simple_scan (target, path) except PermissionError as e : print ("Not accessible", path, "(", e, ")") except Exception as e : print ("Another Error in", path, "(", type (e), str (e), ")") def scan_dir (self, path) : self.scan (self.tree, path) # path = "." path = "temp/easyui-tree" app = QApplication (sys.argv) win = Window () win.show () win.scan_dir (path) sys.exit (app.exec_ ())