import os, sys sys.stdout.reconfigure(encoding='utf-8') root = r'D:\code\crm-api-docs' targets = ['线索管理', '线索规则-公海池配置', '线索规则-行政区划', '列偏好', '权限点管理', '系统管理'] for t in targets: p = os.path.join(root, t) if not os.path.isdir(p): print(f'[{t}] NOT FOUND'); continue print(f'[{t}]') for dirpath, dirnames, filenames in os.walk(p): for f in sorted(filenames): rel = os.path.relpath(os.path.join(dirpath, f), p) print(' ' + rel) print('[root files]') for f in sorted(os.listdir(root)): fp = os.path.join(root, f) if os.path.isfile(fp): print(' ' + f)