1 #encoding:utf8 2 import os 3 4 fpath = ‘D:\Download\LP传奇-麒麟传说\Date‘ 5 rfile = ‘‘ 6 7 files = [] 8 mdbFiles = [] 9 str=bytes(‘\x00\x01\x00\x00Standard Jet D‘,‘utf-8‘) 10 11 # find files in flist 12 def allFiles(dir): 13 for f in os.listdir(dir): 14 file = os.path.join(dir,f) 15 if os.path.isdir(file): 16 allFiles(file) 17 elif os.path.isfile(file): 18 files.append(file) 19 20 allFiles(fpath) 21 22 # Extract the first 38 characters of each file 23 for x in range(0,len(files)): 24 rfile = open(files[x],‘rb‘) 25 mdbFiles.append(rfile.read(38)) 26 27 # To determine whether mdbFiles[x] contains str 28 for x in range(0,len(mdbFiles)): 29 if str in mdbFiles[x]: 30 print("IS MDB -> {0}".format(files[x]))
时间: 2024-10-18 03:27:15