Index of every page on this site: llms.txt
All skills
steelan9199 avatar

/recycle-bin-inspector-yashu

@9e01957
Run it yourself

查看 Windows 回收站里有哪些文件、有多少个。默认只列出最多 6 个文件名,用户要求看全部时列出所有回收站文件名。当用户问"回收站里有几个文件""回收站里有什么""回收站空了没""回收站还有多少东西""看下回收站""我删的文件能恢复吗""清空回收站会怎样",或需要确认某文件是否还在回收站、判断磁盘空间是否被回收站占用时使用。也用于核对资源管理器回收站显示的数量是否准确、排查"元数据还在但内容丢失"的幽灵残留条目。

  • 2 files
  • 15 KB
  • Updated 2 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/steelan9199/wechat-publisher/recycle-bin-inspector-yashu

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈152 tokens for metadata: the name and description. ≈1.2k when used: this file.

Description uses 3.0% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈241 characters, or 3.0%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Windows 回收站查看

统计并列出 Windows 回收站的文件。口径与资源管理器 GUI 完全一致。

脚本位置:scripts/list_recycle_bin.py(纯标准库,无需 pip 安装)

解释器路径(本机): D:\software\uv\python\cpython-3.14.7-windows-x86_64-none\python.exe

一、快速开始

PY="D:/software/uv/python/cpython-3.14.7-windows-x86_64-none/python.exe"
S="C:/Users/Administrator/.workbuddy/skills/recycle-bin-inspector-yashu/scripts/list_recycle_bin.py"

"$PY" "$S"                 # 默认:总数 + 最多 6 个文件名
"$PY" "$S" --all           # 打印所有回收站文件名
"$PY" "$S" --drive D       # 只看 D 盘
"$PY" "$S" --limit 20      # 自定义上限
"$PY" "$S" --json          # 输出 JSON

结果一律写入文件(默认当前目录 recycle_bin_report.txt,可用 --out 改), 然后用 Read 读那个文件。不要只依赖 stdout 回显 —— 本机 stdout 常常不回传。

提示:报告里如果含非 ASCII 字符,Read 工具可能判为二进制文件而拒绝打开。 此时用 Python 读回:python -c "import sys;sys.stdout.reconfigure(encoding='utf-8',errors='replace');print(open(r'路径',encoding='utf-8').read())"

二、行为约定(重要)

默认只显示 6 个。 用户明确要求"全部""所有""都列出来""看完整清单"时,加 --all 输出全部条目,并在回复中说明总数。

不要自作主张一次性打印几十条 —— 回收站动辄上百项,刷屏且无用。先给 6 条 + 总数,让用户决定要不要展开。

三、计数口径(关键,务必理解)

回收站里存在两套数字,混淆会得出完全错误的结论:

概念 含义 是否显示在 GUI
有效条目 $I 元数据 + $R 内容文件双全 ✅ 显示,可还原
幽灵残留 只有 $I 元数据,$R 内容已丢失 ❌ 不显示,还原会失败

本技能只统计「有效条目」,因此数字 = 资源管理器显示的数字。幽灵残留单独报一个计数,不混入总数。

实测参考:本机 C 盘有 29 条元数据,但有效条目 0 个 —— GUI 同样显示 0。 若按元数据条数汇报,会得出"C 盘有 29 个文件在回收站"的错误结论。

不要用「元数据条数」回答用户问的"回收站里有几个文件"。

四、回收站是按盘隔离的

不是全局一个目录,而是每个盘各有一个 X:\$Recycle.BIN:

  • 资源管理器里的「回收站」是所有盘的聚合视图,数据各存各的,从不合并
  • 从哪个盘删文件,就进那个盘的回收站
  • 脚本默认扫描所有就绪盘符(C: D: E: F: ...),逐盘统计
  • 某盘没有 $Recycle.BIN 目录 = 从未在该盘删过文件,属正常

五、输出结构

有效条目总数 / 占用空间合计 / 不可恢复残留条数
— 各盘分布 —        每盘项数 + 体积 + GUI 报告数
— 条目清单 —        序号、删除时间、原始大小、原始完整路径
— 交叉校验 —        脚本数字 vs Shell API 数字

脚本会用 SHQueryRecycleBinW 取 Shell 权威数字做交叉校验,不一致会打 ⚠ 警告。 这个校验信号很重要 —— 若出现 ⚠,说明元数据解析与系统视图脱节,数字不可信,应如实告知用户。

六、技术要点

  • 纯标准库 + ctypes,不调 COM、不用 PowerShell。原因:COM 在本机被安全策略拦截;而 PowerShell 每次运行都会向回收站投递 __PSScriptPolicyTest_*.ps1 临时脚本,污染计数。
  • 只统计 S-1-5-21* 开头的 SID 目录(当前用户),跳过 S-1-5-18(系统,仅 desktop.ini)。
  • $I 文件布局:8 字节版本号 + 8 字节原大小 + 8 字节删除时间(FILETIME) + UTF-16LE 原始路径。
  • 易踩的坑:os.path.join("D:", "$Recycle.BIN") 得到 D:$Recycle.BIN(缺反斜杠),因为 "D:" 被当作驱动器相对路径。必须显式补 \。已修复,改动扫描逻辑时勿回退。
  • 文件名显示原始完整路径而非纯文件名 —— 回收站里重名极多,只给文件名无法区分。

七、注意事项

  • 本技能只读不删。清空回收站、恢复文件都是破坏性操作,必须由用户明确发起,并先用本技能列出待处理清单供确认。
  • 大文件(数百 MB)被删后,若只剩元数据、内容已丢失,无法恢复。发现此类条目应主动提示用户,避免用户误以为"还在回收站里能捞回来"而放弃其他找回途径。

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 9e01957. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 2 months ago
disable-model-invocation
false

README badge

README badge for steelan9199/wechat-publisher/recycle-bin-inspector-yashu