编程

Files

Safely organize, deduplicate, and analyze files with intelligent bulk operations and full undo support.

它能做什么

**YES:** Organize existing files, find duplicates, analyze disk usage, batch rename/move, clean up clutter **NO:** Open files, create files/folders, copy files, extract archives, basic file browsing — use standard file operations for those

技能文档

What This Skill Does (and Doesn't)

YES: Organize existing files, find duplicates, analyze disk usage, batch rename/move, clean up clutter NO: Open files, create files/folders, copy files, extract archives, basic file browsing — use standard file operations for those

This is a power tool for reorganization, not a replacement for basic file commands.

Path Security (Non-Negotiable)

  • Canonicalize ALL paths before any operation: resolve .., ~, symlinks, then validate
  • After canonicalization, reject if path is outside user's home or explicitly allowed directories
  • NEVER follow symlinks during traversal — report them as "symlink to X, skipped" and let user decide
  • Block these paths absolutely: /, /etc, /var, /usr, /System, /Library, C:\Windows, C:\Program Files
  • Paths containing .. after canonicalization = reject with explanation

Fast Path vs Safe Path

Fast path (1-9 files): Execute immediately with brief confirmation: "Move 3 files to Archive? [Y/n]" Safe path (10+ files): Create manifest, show summary, require explicit "yes" or review

This prevents confirmation fatigue for simple operations while protecting bulk actions.

Trash Handling

  • Use the operating system's native trash: trash CLI on macOS/Linux, Recycle Bin API on Windows
  • If OS trash unavailable, move to ~/.local/share/file-organizer-trash/ with metadata sidecar
  • Metadata sidecar (JSON): original path, deletion timestamp, operation ID — NOT path-in-filename
  • Never permanently delete without explicit "permanently delete" or "empty trash" command

Undo System

  • Every operation creates an undo record in ~/.local/share/file-organizer/undo/TIMESTAMP.json
  • Record contains: operation type, source paths, destination paths, checksums of moved files
  • "Undo last" reverses the most recent operation using the record
  • Undo records expire after 30 days — warn user before expiry
  • NO shell scripts for undo — JSON metadata only, executed by the agent
  • During directory traversal: skip symlinks, report them separately
  • "This folder contains 12 symlinks pointing outside — review before proceeding?"
  • Never follow symlinks automatically — they're a classic attack vector
  • User can explicitly request "follow symlinks" but must confirm each external target

Duplicate Detection (Scalable)

  • Phase 1: Group by exact size (instant, no I/O)
  • Phase 2: Hash first 4KB of same-size files (fast filter)
  • Phase 3: Full hash only for files matching phase 2
  • For >10,000 files, require confirmation: "This will take ~15 minutes. Proceed?"
  • Cache hashes in ~/.local/share/file-organizer/hash-cache.db (SQLite) with mtime invalidation

Bulk Operations

  • Batch rename: Preview ALL transformations if <50 files, first/last 10 if more, always show total count
  • Batch move: Verify destination has space before starting, atomic per-file with rollback on error
  • Progress: Update every 5% or 30 seconds, whichever is less frequent — not per-file spam
  • Error handling: On ANY error, stop, report what succeeded/failed, offer "continue skipping errors" or "rollback completed"

Organization Proposals

  • Analyze directory contents FIRST, then propose: "80% images, 15% videos, 5% docs — organize by date or type?"
  • Always show concrete examples: "vacation-photo.jpg → 2024/06-June/vacation-photo.jpg"
  • Preserve original filenames unless user requests rename pattern
  • Create .file-organizer-manifest.json in destination documenting the reorganization for future reference

Size Analysis

  • Top consumers by directory, not individual files — users think in folders
  • Flag known safe-to-delete: node_modules, pycache, .gradle, build/, target/, Pods/
  • Calculate actual vs apparent size (sparse files, hardlinks)
  • For cleanup suggestions, always state recoverability: "Deleting node_modules: fully recoverable with npm install"

Platform Specifics

  • macOS: Respect .app bundles (they're directories), use trash via Homebrew if available
  • Windows: Use long path prefix \\?\ for paths >260 chars, use shell API for Recycle Bin
  • Linux: XDG trash spec (~/.local/share/Trash/), handle different filesystem capabilities

Limits and Failures

  • Refuse operations on >100,000 files without explicit override: "This affects 250K files. Type 'I understand' to proceed"
  • If manifest would exceed 10MB, paginate: "Showing batch 1 of 15 (page through with 'next')"
  • Network drives: detect by response time, warn about reliability, suggest local copy first
  • Disk full: check before starting, reserve 1% headroom, fail gracefully with partial completion report

相关技能

把收到的发票归档并审核——OCR、去重校验、增值税分档与可检索的本地存档。

64 次安装2 星标

让 Markdown 在 GitHub、MDX、Pandoc、文档站、Slack、Notion 等解析器中正确渲染,并定位修复具体损坏位置。

296 次安装7 星标

通过 curl 调用 JSON-RPC API 发布 Web 应用,并获得一个公开访问的网址。

152 次安装8 星标

将 OpenClaw 加密备份至 S3 兼容存储桶,支持分阶段恢复与可选定时任务。

89 次安装4 星标

通过自带的 Node CLI 读取与修改 Linear 的 issue、项目和评论。

140 次安装6 星标

Iván 的更多技能

浏览全部技能

执行 Git 操作(提交、分支、合并、变基、冲突解决与恢复)时强制套用安全规则。

作者 Iván527 次安装31 星标

用可量化的层级、间距、字号、配色与版式规则,绘制并诊断视觉作品。

作者 Iván137 次安装5 星标

围绕 CSS 机制排查问题并编写组件样式表,而不是凭感觉试错。

作者 Iván97 次安装5 星标

以系统方式规划并执行自学:从出口测试倒推课程,加入间隔复习与刻意练习,产出可验证的迁移证据。

作者 Iván93 次安装3 星标

针对你的 Azure 订阅,做架构设计、故障排查、安全加固与成本优化

作者 Iván86 次安装2 星标

按配置的 JDK 版本诊断 Java 与 JVM 问题(从 NPE 到容器 OOM),给出可直接套用的代码与配置。

作者 Iván130 次安装9 星标