File Sorter

通用文件智能分类工具,支持多种分类规则:类型、大小、日期、关键词等。适用于需要批量整理文件的场景,如下载文件夹整理、照片归档、文档分类等。

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 178 · 0 current installs · 0 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The name/description describe a local file-classification tool and the included Python script implements exactly those features (type/size/date classification, move/copy/link, preview, undo). No unrelated credentials, binaries, or external services are requested.
Instruction Scope
SKILL.md describes running a 'file-sorter' CLI and provides options that match the script. However, there is no install/packaging guidance: the included file is scripts/file_sorter.py, so the user must ensure the CLI exists (e.g., by installing or creating a wrapper). Instructions and code only operate on local filesystem paths and create a local backup file (.file-sorter-backup.json); they do not read unrelated system files or transmit data externally.
Install Mechanism
No install spec and no external downloads; the skill is instruction+script only. This is low risk because nothing is pulled from the network or written to system locations outside the directories the user specifies.
Credentials
No environment variables, credentials, or config paths are required. The script only reads directories provided as arguments and optionally a .file-sorter.json config in the project directory, which is consistent with the tool's purpose.
Persistence & Privilege
The skill is not always-enabled and does not request elevated or persistent platform privileges. It writes a local backup file (.file-sorter-backup.json) in the output directory to support undo — this is reasonable for its functionality and limited in scope.
Assessment
This skill appears to do what it says: it organizes files locally and creates a local backup log (.file-sorter-backup.json) to support undo. Before installing or running: 1) Confirm how you will invoke the script — SKILL.md shows a 'file-sorter' CLI but the repository contains scripts/file_sorter.py; you may need to create a wrapper or install the script to PATH. 2) Prefer --preview (dry-run) to verify results before running default action (move). 3) Be aware 'move' is the default action and will relocate your files; ensure you have backups if data loss is unacceptable. 4) The backup/undo feature depends on that backup file not being deleted; if you move files manually later, undo may fail. 5) If you plan to allow an agent to run this autonomously, note the script prompts for interactive confirmation (input()); when run non-interactively that may block or cause the operation to be skipped — consider running with preview or adjusting invocation. Overall the skill is coherent and low-risk but treat file-moving operations cautiously.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk972xv501qbmhkgs32y2y38tfx82fn93

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

File Sorter - 文件智能分类工具

功能特性

  • ✅ 多种分类规则:文件类型、文件大小、文件日期、关键词
  • ✅ 灵活操作:移动、复制、创建符号链接
  • ✅ 预览功能:先预览效果,确认后再执行
  • ✅ 撤销操作:支持撤销最近一次整理
  • ✅ 自定义规则:支持自定义分类规则和文件夹结构
  • ✅ 规则预设:保存和加载分类规则预设

快速开始

1. 按文件类型分类

file-sorter organize ~/Downloads --by-type --output ~/Sorted

2. 按文件大小分类

file-sorter organize ~/Downloads --by-size --output ~/Sorted

3. 按文件日期分类(修改日期)

file-sorter organize ~/Downloads --by-date modified --output ~/Sorted

4. 预览模式(不实际执行)

file-sorter organize ~/Downloads --by-type --preview

5. 撤销操作

file-sorter undo ~/Sorted

详细使用说明

分类规则说明

按文件类型分类

  • 默认类别
    • documents:文档类(.pdf, .doc, .docx, .txt, .xls, .xlsx, .ppt, .pptx)
    • images:图片类(.jpg, .jpeg, .png, .gif, .webp, .heic)
    • videos:视频类(.mp4, .avi, .mov, .mkv)
    • audio:音频类(.mp3, .wav, .flac, .aac)
    • installers:安装包类(.exe, .msi, .dmg, .pkg, .deb, .rpm)
    • archives:压缩包类(.zip, .rar, .7z, .tar, .gz)
    • code:代码类(.py, .js, .html, .css, .java, .cpp)
  • 自定义类别:使用 --categories 参数或配置文件

按文件大小分类

  • 默认规则
    • small:小于 1MB
    • medium:1MB - 100MB
    • large:大于 100MB
  • 自定义规则:使用 --size-rules 参数或配置文件

按文件日期分类

  • 选项
    • created:按创建日期
    • modified:按修改日期
    • accessed:按访问日期
  • 文件夹结构:按年/月/日组织(如 2026/03/07)

操作类型

  • move:移动文件(默认)
  • copy:复制文件
  • link:创建符号链接

配置文件

可以在项目根目录创建 .file-sorter.json 配置默认选项:

{
  "output_dir": "~/Sorted",
  "action": "move",
  "categories": {
    "documents": [".pdf", ".doc"],
    "images": [".jpg", ".png"]
  },
  "size_rules": {
    "small": [0, 1048576],
    "medium": [1048576, 104857600],
    "large": [104857600, null]
  },
  "backup_original": true
}

安全措施

  1. 预览模式:默认先显示预览,需要确认后才执行
  2. 自动备份:执行整理前自动保存操作日志
  3. 撤销功能:随时可以撤销最近一次操作
  4. dry-run 选项:使用 --preview 查看效果

示例场景

场景 1:整理下载文件夹

# 按类型整理下载文件
file-sorter organize ~/Downloads --by-type --output ~/Downloads/Organized

场景 2:整理照片

# 按拍摄日期整理照片
file-sorter organize ~/Photos --by-date created --output ~/Photos/ByDate

场景 3:按大小分类大文件

# 找出所有大于 100MB 的文件
file-sorter organize ~/Videos --by-size --output ~/Videos/BySize

故障排除

  • 撤销失败:确保在同一目录下执行,且备份文件未被删除
  • 规则冲突:多个规则匹配时,按规则优先级处理(类型 > 大小 > 日期)
  • 权限问题:确保有文件读写权限

更新日志

v1.0.0 (2026-03-07)

  • 初始正式版本发布
  • 支持按类型、大小、日期分类
  • 支持预览和撤销功能

Files

2 total
Select a file
Select a file to preview.

Comments

Loading comments…