# -*-coding:UTF8-*- import os import json def find_all_files(dirpath): dirlist = os.listdir(dirpath) for i in dirlist: curpath = dirpath + os.sep + i if(os.path.isdir(curpath)): print(curpath) find_all_files(curpath) elif(os.path.isfile(curpath)): try: curpath = os.path.split(curpath) print(" " + curpath[1]) except Exception as e: print(" %s"%e) print(" " + json.dumps(curpath[1])) # dirpath = r"C:Program Files (x86) esterqPythonLibsite-packages obot" # des_text = "CURDIE" # find_all_text_in_dir_files(dirpath) find_all_files(r"D:项目资料大数据中台版本文档")