# -*- coding: utf-8 -*- """票 06 续跑步骤 1:清文档仓第一次跑的错误残留(HANDOFF-2026-09-04 §3.1)。 - D:\code\crm-api-docs\A4 客户管理\A4 客户管理\ (重复嵌套目录,9 子目录) - D:\code\crm-api-docs\A4 客户管理\客户管理\ (错位目录壳,内含超期提醒规则 3 文件) 保留:A4 客户管理\folder.bru、README.md。 幂等:目录不存在则跳过。""" import io, sys, os, shutil sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') DOCS = r'D:\code\crm-api-docs' A4 = os.path.join(DOCS, 'A4 客户管理') LEFTOVERS = [ os.path.join(A4, 'A4 客户管理'), os.path.join(A4, '客户管理'), ] for d in LEFTOVERS: if os.path.isdir(d): n = sum(len(fn) for _, _, fn in os.walk(d)) shutil.rmtree(d) print(f'removed: {os.path.relpath(d, DOCS)} ({n} files)') else: print(f'skip (absent): {os.path.relpath(d, DOCS)}') print('--- after cleanup, A4 tree ---') for dp, dn, fn in os.walk(A4): for f in fn: print(' ', os.path.relpath(os.path.join(dp, f), DOCS))