clawhub install ai-file-organizer📖 About This Skill
name: ai-file-organizer description: AI 智能文件整理 - 批量重命名、自动分类、智能归档(异步引擎 + 云同步) version: 3.0.0 tags: [file-management, automation, ai, organization, productivity, async, cloud-sync] user-invocable: true
AI File Organizer Skill v3.0.0
下一代智能文件整理工具 - 异步引擎、AI 内容分析、云同步、版本管理
🎯 触发条件
/organize-files 或 "帮我整理文件"、"清理重复文件"✨ 核心功能
1. 异步处理引擎 🚀
2. AI 内容分析 🧠
3. 智能缓存系统 💾
4. 云同步支持 ☁️
5. 文件版本管理 🔄
6. 重复文件清理 🗑️
7. 交互式 CLI 👆
8. 智能清理建议 💡
📋 配置参数
# 命名规则
naming:
format: "{date}_{type}_{original}" # 日期_类型_原名
date_format: "%Y%m%d"
max_length: 100
replace_spaces: true分类规则
classification:
enabled: true
ai_analysis: true # 启用 AI 内容分析
categories:
- name: "工作文档"
keywords: ["报告", "方案", "合同", "发票"]
folder: "Work/Documents"
- name: "学习资料"
keywords: ["教程", "课程", "笔记"]
folder: "Learning"
- name: "图片视频"
extensions: ["jpg", "png", "mp4", "mov"]
folder: "Media"
- name: "代码项目"
extensions: ["py", "js", "java", "go", "rs"]
folder: "Code"重复文件处理
duplicates:
enabled: true
similarity_threshold: 0.95
keep_best: true
move_to_folder: "_duplicates"云同步
cloud_sync:
enabled: false
provider: "aliyun" # aliyun | baidu | onedrive
access_key: "${ALIYUN_ACCESS_KEY}"
secret_key: "${ALIYUN_SECRET_KEY}"
bucket: "my-files"
auto_sync: true版本管理
versioning:
enabled: true
max_versions: 5
version_folder: ".versions"缓存
cache:
enabled: true
max_size: 10000
ttl_days: 7性能
performance:
max_concurrent: 10
chunk_size: 8192
use_async_io: true日志
logging:
level: "INFO"
file: "logs/organizer.log"
format: "json"
🚀 使用示例
示例 1: 整理下载文件夹
# 基础整理
python scripts/organizer.py --organize ~/Downloads指定目标文件夹
python scripts/organizer.py --organize ~/Downloads --target ~/Organized高性能模式
python scripts/organizer.py --organize ~/Downloads --concurrent 20
示例 2: 清理重复文件
# 检测重复
python scripts/organizer.py --duplicates ~/Files清理并移动
python scripts/organizer.py --duplicates ~/Files --move-to _duplicates
示例 3: 使用配置文件
# 使用自定义配置
python scripts/organizer.py --organize ~/Downloads --config config.yaml导出整理报告
python scripts/organizer.py --organize ~/Downloads --report report.json
示例 4: 预览模式
# 先预览整理方案
python scripts/organizer.py --organize ~/Downloads --dry-run交互确认模式
python scripts/organizer.py --organize ~/Downloads --interactive
示例 5: 云同步
# 配置环境变量
export ALIYUN_ACCESS_KEY="your_key"
export ALIYUN_SECRET_KEY="your_secret"整理并同步
python scripts/organizer.py --organize ~/Downloads --config cloud_config.yaml
📊 输出示例
============================================================
🚀 开始文件整理 (v3.0.0 异步引擎)
============================================================
📂 源目录:/home/user/Downloads
📁 目标目录:/home/user/Organized
📊 发现 523 个文件处理进度: 100%|████████████████| 523/523 [00:26<00:00, 20.1file/s]
============================================================
📊 整理完成
============================================================
总文件数:523
✅ 成功:520
❌ 失败:3
⚡ 速度:20.0 个/秒
⏱️ 耗时:26.0 秒
💾 缓存命中率:68.5%
分类统计:
📄 Documents: 125 个
🖼️ Images: 234 个
🎥 Videos: 89 个
💻 Code: 45 个
📦 Archives: 27 个
📋 报告已导出:report.json
🔧 命令行参数
usage: organizer.py [-h] [--demo] [--organize DIR] [--target DIR]
[--duplicates DIR] [--config FILE] [--concurrent N]
[--no-cache] [--verbose] [--report FILE]可选参数:
-h, --help 显示帮助信息
--demo 运行演示
--organize DIR 整理指定文件夹
--target DIR 目标文件夹
--duplicates DIR 检测重复文件
--config FILE 配置文件路径
--concurrent N 最大并发数 (默认:10)
--no-cache 禁用缓存
--verbose, -v 详细输出
--report FILE 导出报告路径
📈 性能基准
| 场景 | v2.0.0 | v3.0.0 | 提升 | |------|--------|--------|------| | 1000 文件 | 45 秒 | 26 秒 | 73% ⬆️ | | 10000 文件 | 8 分钟 | 4.5 分钟 | 78% ⬆️ | | 内存占用 | 256MB | 128MB | 50% ⬇️ | | 缓存命中率 | 0% | 70% | 新增 |
🛡️ 安全特性
🔌 扩展开发
添加自定义分类器
from organizer import AIFileOrganizerclass CustomOrganizer(AIFileOrganizer):
def classify_file(self, file_path, filename):
# 自定义分类逻辑
if 'invoice' in filename.lower():
return 'Finance/Invoices', 0.95
return super().classify_file(file_path, filename)
添加云存储 provider
from cloud_providers.base import BaseCloudProviderclass CustomCloudProvider(BaseCloudProvider):
def upload(self, file_path, remote_path):
# 实现上传逻辑
pass
def download(self, remote_path, local_path):
# 实现下载逻辑
pass
🐛 常见问题
Q: 处理速度慢?
A: 1. 增加并发数:--concurrent 20
2. 启用缓存:确保 cache.enabled: true
3. 检查磁盘 IO 性能Q: 分类不准确?
A: 1. 完善分类规则的关键词 2. 启用 AI 内容分析:ai_analysis.enabled: true
3. 检查文件名是否包含足够信息Q: 云同步失败?
A: 1. 检查 API 密钥配置 2. 确认网络连接正常 3. 查看日志:logs/organizer.log📚 相关文档
🧪 测试
# 单元测试
python -m pytest tests/test_organizer.py -v覆盖率报告
python -m pytest tests/test_organizer.py -v --cov=scripts --cov-report=html性能基准测试
python tests/benchmark.py
📦 依赖
必需:
可选:
📄 许可证
MIT License
👥 作者
于金泽
版本: 3.0.0 更新日期: 2026-03-16 文档: https://github.com/your-repo/ai-file-organizer