Python脚本遍历文件夹,检查文件版本是否存在
from win32api import GetFileVersionInfo, LOWORD, HIWORD import os import fnmatch def get_version_number (filename): try: info = GetFileVersionInfo (filename, "//") ms = info['FileVersionMS'] ls = info['FileVersionLS'] return HIWORD (ms), LOWORD (ms), HIWORD (ls), LOWORD (ls) except: return 0,0,0,0 def main(): path=r"C:/Program Files (x86)/Zoom/bin" for root, dir, files in os.walk(path): files = fnmatch.filter(files, "*.exe") + fnmatch.filter(files, "*.dll") for item in files: version = get_version_number(os.path.join(root, item)) if version == (0,0,0,0): print(item) if __name__ == '__main__': main()
原创文章,作者:sunnyman218,如若转载,请注明出处:https://blog.ytso.com/272021.html