mcpField
F
file-organizer

file-organizer

github.com/89jobrien生产力437 次安装9 周前更新
代码仓库

关于 file-organizer

file-organizer 是用于 Claude Code 的文件整理 Skill,可分析目录、查找重复文件并规划文件夹结构。经确认后,它会移动或重命名文件,并记录变更。

主要功能

  1. 01分析目录与文件类型
  2. 02查找重复文件
  3. 03建议文件夹结构
  4. 04经确认后移动和重命名
  5. 05记录变更以便撤销

适用场景

  1. 01整理杂乱的 Downloads 文件夹
  2. 02删除前检查重复文件
  3. 03区分活跃项目与归档项目
  4. 04按日期整理照片

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/89jobrien/steve --skill file-organizer

安装后在 Claude Code 中输入/file-organizer确认已加载。

详细介绍

文件整理工具

这项技能可充当你的个人整理助手,帮助你在电脑上保持文件结构整洁、合理,省去持续手动整理的麻烦。

何时使用这项技能

  • 你的 Downloads 文件夹杂乱无章
  • 文件散落各处,导致你找不到它们
  • 你有重复文件,占用了存储空间
  • 你的文件夹结构已经不再合理
  • 你想养成更好的整理习惯
  • 你要开始一个新项目,需要一个合适的结构
  • 你要归档旧项目,想先整理一番

这项技能的功能

  1. 分析当前结构:检查你的文件夹和文件,了解其中的内容
  2. 查找重复文件:识别系统中的重复文件
  3. 提出整理方案:根据文件内容提出合理的文件夹结构
  4. 自动整理:在获得你的批准后,移动、重命名和整理文件
  5. 结合上下文判断:根据文件类型、日期和内容做出明智的判断
  6. 减少杂乱:找出你可能不再需要的旧文件

使用方法

从你的主目录开始
cd ~

然后运行 Claude Code 并请求帮助:

Help me organize my Downloads folder
Find duplicate files in my Documents folder
Review my project directories and suggest improvements
特定整理任务
Organize these downloads into proper folders based on what they are
Find duplicate files and help me decide which to keep
Clean up old files I haven't touched in 6+ months
Create a better folder structure for my [work/projects/photos/etc]

说明

当用户请求帮助整理文件时:

  1. 了解范围

    提出澄清问题:

    • 哪个目录需要整理?(Downloads、Documents,还是整个主文件夹?)
    • 主要问题是什么?(找不到东西、重复文件太多、太杂乱,还是缺乏结构?)
    • 有没有需要避开的文件或文件夹?(当前项目、敏感数据?)
    • 希望整理到什么程度?(保守整理还是全面清理?)
  2. 分析当前状态

    检查目标目录:

    # Get overview of current structure
    ls -la [target_directory]
    
    # Check file types and sizes
    find [target_directory] -type f -exec file {} \; | head -20
    
    # Identify largest files
    du -sh [target_directory]/* | sort -rh | head -20
    
    # Count file types
    find [target_directory] -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn
    

    总结发现:

    • 文件和文件夹总数
    • 文件类型分布
    • 大小分布
    • 日期范围
    • 明显的整理问题
  3. 识别整理模式

    根据文件确定合理的分组方式:

    按类型:

    • 文档(PDF、DOCX、TXT)
    • 图片(JPG、PNG、SVG)
    • 视频(MP4、MOV)
    • 压缩包(ZIP、TAR、DMG)
    • 代码/项目(包含代码的目录)
    • 电子表格(XLSX、CSV)
    • 演示文稿(PPTX、KEY)

    按用途:

    • 工作与个人
    • 活跃项目与归档项目
    • 特定项目
    • 参考资料
    • 临时/草稿文件

    按日期:

    • 当前年/月
    • 往年
    • 很久以前的文件(可考虑归档)
  4. 查找重复文件

    根据请求搜索重复文件:

    # Find exact duplicates by hash
    find [directory] -type f -exec md5 {} \; | sort | uniq -d
    
    # Find files with same name
    find [directory] -type f -printf '%f\n' | sort | uniq -d
    
    # Find similar-sized files
    find [directory] -type f -printf '%s %p\n' | sort -n
    

    对于每组重复文件:

    • 显示所有文件路径
    • 显示大小和修改日期
    • 建议保留哪个文件(通常是最新的或文件名更清晰的)
    • 重要:删除前务必征求确认
  5. 提出整理计划

    执行更改前,先提供清晰的计划:

    # Organization Plan for [Directory]
    
    ## Current State
    - X files across Y folders
    - [Size] total
    - File types: [breakdown]
    - Issues: [list problems]
    
    ## Proposed Structure
    
    

    [Directory]/ ├── Work/ │ ├── Projects/ │ ├── Documents/ │ └── Archive/ ├── Personal/ │ ├── Photos/ │ ├── Documents/ │ └── Media/ └── Downloads/ ├── To-Sort/ └── Archive/

    
    ## Changes I'll Make
    
    1. **Create new folders**: [list]
    2. **Move files**:
       - X PDFs → Work/Documents/
       - Y images → Personal/Photos/
       - Z old files → Archive/
    3. **Rename files**: [any renaming patterns]
    4. **Delete**: [duplicates or trash files]
    
    ## Files Needing Your Decision
    
    - [List any files you're unsure about]
    
    Ready to proceed? (yes/no/modify)
    
  6. 执行整理

    获得批准后,系统地整理文件:

    # Create folder structure
    mkdir -p "path/to/new/folders"
    
    # Move files with clear logging
    mv "old/path/file.pdf" "new/path/file.pdf"
    
    # Rename files with consistent patterns
    # Example: "YYYY-MM-DD - Description.ext"
    

    重要规则:

    • 删除任何内容前务必确认
    • 记录所有移动操作,以便必要时撤销
    • 保留原始修改日期
    • 妥善处理文件名冲突
    • 遇到意外情况时停止并询问
  7. 提供总结和维护建议

    整理完成后:

    # Organization Complete! ✨
    
    ## What Changed
    
    - Created [X] new folders
    - Organized [Y] files
    - Freed [Z] GB by removing duplicates
    - Archived [W] old files
    
    ## New Structure
    
    [Show the new folder tree]
    
    ## Maintenance Tips
    
    To keep this organized:
    
    1. **Weekly**: Sort new downloads
    2. **Monthly**: Review and archive completed projects
    3. **Quarterly**: Check for new duplicates
    4. **Yearly**: Archive old files
    
    ## Quick Commands for You
    
    ```bash
    # Find files modified this week
    find . -type f -mtime -7
    
    # Sort downloads by type
    [custom command for their setup]
    
    # Find duplicates
    [custom command]
    

    还要整理其他文件夹吗?

Examples

Example 1: Organizing Downloads (From Justin Dielmann)

User: "My Downloads folder is a mess with 500+ files. Help me organize it."

Process:

  1. Analyzes Downloads folder
  2. Finds patterns: work docs, personal photos, installers, random PDFs
  3. Proposes structure:
    • Downloads/
      • Work/
      • Personal/
      • Installers/ (DMG, PKG files)
      • Archive/
      • ToSort/ (things needing decisions)
  4. Asks for confirmation
  5. Moves files intelligently based on content and names
  6. Results: 500 files → 5 organized folders
Example 2: Finding and Removing Duplicates

User: "Find duplicate files in my Documents and help me decide which to keep."

Output:

# Found 23 Sets of Duplicates (156 MB total)

## Duplicate Set 1: "proposal.pdf"
- `/Documents/proposal.pdf` (2.3 MB, modified: 2024-03-15)
- `/Documents/old/proposal.pdf` (2.3 MB, modified: 2024-03-15)
- `/Desktop/proposal.pdf` (2.3 MB, modified: 2024-03-10)

**Recommendation**: Keep `/Documents/proposal.pdf` (most recent in correct location)
Delete the other 2 copies?

[Continue for all duplicates...]
示例 3:重新整理 Projects 文件夹

用户:“检查我的 ~/Projects 目录并提出改进建议。”

输出:

# Analysis of ~/Projects

## Current Structure Issues
- Mix of active and archived projects (3+ years old)
- No consistent naming convention
- Some projects at root, others in random subfolders
- Duplicate folders (project-name, project-name-old, project-name-v2)

## Proposed Structure

Projects/ ├── Active/ │ ├── client-work/ │ ├── side-projects/ │ └── learning/ ├── Archive/ │ ├── 2022/ │ ├── 2023/ │ └── 2024/ └── Templates/


## Specific Changes
1. Move 12 projects not touched since 2022 → Archive/
2. Consolidate 4 duplicate project folders
3. Rename projects to consistent format: "client-name-project-name"
4. Create Archive for old work

Want me to implement this?
示例 4:按日期整理照片

用户:“按年份和月份整理我的照片文件夹。”

输出:创建如下结构:

Photos/
├── 2023/
│   ├── 01-January/
│   ├── 02-February/
│   └── ...
├── 2024/
│   ├── 01-January/
│   └── ...
└── Unsorted/

然后根据 EXIF 数据或文件修改日期移动照片。

常见整理任务

清理下载文件夹
Organize my Downloads folder - move documents to Documents,
images to Pictures, keep installers separate, and archive files
older than 3 months.
整理项目
Review my Projects folder structure and help me separate active
projects from old ones I should archive.
删除重复文件
Find all duplicate files in my Documents folder and help me
decide which ones to keep.
清理桌面
My Desktop is covered in files. Help me organize everything into
my Documents folder properly.
整理照片
Organize all photos in this folder by date (year/month) based
on when they were taken.
分开工作和个人文件
Help me separate my work files from personal files across my
Documents folder.

实用技巧

  1. 从小处着手:先整理一个杂乱的文件夹(例如“下载”文件夹),以建立信任
  2. 定期维护:每周清理一次“下载”文件夹
  3. 统一命名:重要文件使用“YYYY-MM-DD - Description”格式
  4. 积极归档:将旧项目移至 Archive,而不是删除
  5. 将当前工作分开:明确区分当前工作与已归档工作
  6. 相信流程:让 Claude 负责判断文件的存放位置,减轻你的认知负担

最佳实践

文件夹命名
  • 使用清晰、描述性强的名称
  • 避免使用空格(使用连字符或下划线)
  • 使用具体名称:“client-proposals”,而不是“docs”
  • 使用前缀排序:“01-current”“02-archive”
文件命名
  • 包含日期:“2024-10-17-meeting-notes.md”
  • 使用描述性名称:“q3-financial-report.xlsx”
  • 避免在名称中使用版本号(改用版本控制)
  • 移除下载产生的冗余后缀:“document-final-v2 (1).pdf” → “document.pdf”
何时归档
  • 6 个月以上未处理的项目
  • 以后可能会查阅的已完成工作
  • 迁移到新系统后的旧版本
  • 不确定是否要删除的文件(先归档)

相关使用场景

  • 为新电脑设置文件整理结构
  • 为备份或归档整理文件
  • 清理存储空间前整理文件
  • 整理共享团队文件夹
  • 为新项目创建目录结构

评论

支持 Markdown