file-organizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

File Organizer

文件整理工具

When to Use This Skill

适用场景

  • Your Downloads folder is a chaotic mess
  • You can't find files because they're scattered everywhere
  • You have duplicate files taking up space
  • Your folder structure doesn't make sense anymore
  • You want to establish better organization habits
  • You're starting a new project and need a good structure
  • You're cleaning up before archiving old projects
  • 你的下载文件夹杂乱无章
  • 因为文件分散各处而无法找到所需文件
  • 存在占用存储空间的重复文件
  • 现有的文件夹结构逻辑混乱
  • 你想要建立更好的文件整理习惯
  • 你正在启动新项目,需要合理的结构
  • 你在归档旧项目前需要清理文件

What This Skill Does

该工具的功能

  1. Analyzes Current Structure: Reviews your folders and files to understand what you have
  2. Finds Duplicates: Identifies duplicate files across your system
  3. Suggests Organization: Proposes logical folder structures based on your content
  4. Automates Cleanup: Moves, renames, and organizes files with your approval
  5. Maintains Context: Makes smart decisions based on file types, dates, and content
  6. Reduces Clutter: Identifies old files you probably don't need anymore
  1. 分析当前结构:检查你的文件夹和文件,了解现有内容
  2. 查找重复项:识别系统中的重复文件
  3. 建议整理方案:根据内容提出合理的文件夹结构
  4. 自动清理:在你确认后移动、重命名并整理文件
  5. 保留上下文:根据文件类型、日期和内容做出智能决策
  6. 减少杂乱:识别你可能不再需要的旧文件

Instructions

使用说明

When a user requests file organization help:
  1. Understand the Scope
    Ask clarifying questions:
    • Which directory needs organization? (Downloads, Documents, entire home folder?)
    • What's the main problem? (Can't find things, duplicates, too messy, no structure?)
    • Any files or folders to avoid? (Current projects, sensitive data?)
    • How aggressively to organize? (Conservative vs. comprehensive cleanup)
  2. Analyze Current State
    Review the target directory:
    bash
    # 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
    Summarize findings:
    • Total files and folders
    • File type breakdown
    • Size distribution
    • Date ranges
    • Obvious organization issues
  3. Identify Organization Patterns
    Based on the files, determine logical groupings:
    By Type:
    • Documents (PDFs, DOCX, TXT)
    • Images (JPG, PNG, SVG)
    • Videos (MP4, MOV)
    • Archives (ZIP, TAR, DMG)
    • Code/Projects (directories with code)
    • Spreadsheets (XLSX, CSV)
    • Presentations (PPTX, KEY)
    By Purpose:
    • Work vs. Personal
    • Active vs. Archive
    • Project-specific
    • Reference materials
    • Temporary/scratch files
    By Date:
    • Current year/month
    • Previous years
    • Very old (archive candidates)
  4. Find Duplicates
    When requested, search for duplicates:
    bash
    # Find exact duplicates by hash
    find [directory] -type f -exec md5 {} \; | sort | uniq -d
    
    # Find files with similar names
    find [directory] -type f -printf '%f\n' | sort | uniq -d
    
    # Find similar-sized files
    find [directory] -type f -printf '%s %p\n' | sort -n
    For each set of duplicates:
    • Show all file paths
    • Display sizes and modification dates
    • Recommend which to keep (usually newest or best-named)
    • Important: Always ask for confirmation before deleting
  5. Propose Organization Plan
    Present a clear plan before making changes:
    markdown
    # 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. Execute Organization
    After approval, organize systematically:
    bash
    # 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"
    Important Rules:
    • Always confirm before deleting anything
    • Log all moves for potential undo
    • Preserve original modification dates
    • Handle filename conflicts gracefully
    • Stop and ask if you encounter unexpected situations
  7. Provide Summary and Maintenance Tips
    After organizing:
    markdown
    # 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
    
    # Find files modified this week
    
    find . -type f -mtime -7
    
    # Sort downloads by type
    
    [custom command for their setup]
    
    # Find duplicates
    
    [custom command]
    Want to organize another folder?
当用户请求文件整理帮助时:
  1. 明确范围
    提出澄清问题:
    • 需要整理哪个目录?(下载文件夹、文档文件夹、整个主目录?)
    • 主要问题是什么?(找不到文件、重复文件、过于杂乱、结构不合理?)
    • 有没有需要避开的文件或文件夹?(当前项目、敏感数据?)
    • 整理的激进程度如何?(保守型 vs 全面清理)
  2. 分析当前状态
    检查目标目录:
    bash
    # 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. 确定整理模式
    根据文件内容,确定合理的分组方式:
    按类型:
    • 文档(PDFs, DOCX, TXT)
    • 图片(JPG, PNG, SVG)
    • 视频(MP4, MOV)
    • 压缩包(ZIP, TAR, DMG)
    • 代码/项目(包含代码的目录)
    • 电子表格(XLSX, CSV)
    • 演示文稿(PPTX, KEY)
    按用途:
    • 工作 vs 个人
    • 活跃项目 vs 归档项目
    • 特定项目
    • 参考资料
    • 临时/草稿文件
    按日期:
    • 当前年/月
    • 往年
    • 非常旧的文件(归档候选)
  4. 查找重复项
    当用户请求时,搜索重复文件:
    bash
    # Find exact duplicates by hash
    find [directory] -type f -exec md5 {} \; | sort | uniq -d
    
    # Find files with similar names
    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. 提出整理方案
    在执行更改前,先呈现清晰的方案:
    markdown
    # [目录]整理方案
    
    ## 当前状态
    
    - 共X个文件,分布在Y个文件夹中
    - 总大小:[Size]
    - 文件类型:[类型分布]
    - 存在的问题:[列出问题]
    
    ## 建议的结构
    
    [Directory]/
    ├── 工作/
    │ ├── 项目/
    │ ├── 文档/
    │ └── 归档/
    ├── 个人/
    │ ├── 图片/
    │ ├── 文档/
    │ └── 媒体/
    └── 下载/
    ├── 待分类/
    └── 归档/
    
    ## 将要执行的操作
    
    1. **创建新文件夹**:[列出文件夹]
    2. **移动文件**:
       - X个PDF文件 → 工作/文档/
       - Y个图片 → 个人/图片/
       - Z个旧文件 → 归档/
    3. **重命名文件**:[重命名规则]
    4. **删除文件**:[重复文件或无用文件]
    
    ## 需要你决策的文件
    
    - [列出不确定的文件]
    
    是否准备开始?(是/否/修改)
  6. 执行整理
    获得用户批准后,系统地执行整理:
    bash
    # 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. 提供总结和维护建议
    整理完成后:
    markdown
    # 整理完成!✨
    
    ## 变更内容
    
    - 创建了[X]个新文件夹
    - 整理了[Y]个文件
    - 通过删除重复文件释放了[Z]GB存储空间
    - 归档了[W]个旧文件
    
    ## 新结构
    
    [展示新的文件夹树]
    
    ## 维护建议
    
    为了保持文件有序:
    
    1. **每周**:整理新下载的文件
    2. **每月**:检查并归档已完成的项目
    3. **每季度**:检查是否出现新的重复文件
    4. **每年**:归档旧文件
    
    ## 实用命令
    
    # 查找本周修改的文件
    
    find . -type f -mtime -7
    
    # 按类型整理下载文件
    
    [适配你系统的自定义命令]
    
    # 查找重复文件
    
    [自定义命令]
    是否需要整理其他文件夹?

Best Practices

最佳实践

Folder Naming

文件夹命名

  • Use clear, descriptive names
  • Avoid spaces (use hyphens or underscores)
  • Be specific: "client-proposals" not "docs"
  • Use prefixes for ordering: "01-current", "02-archive"
  • 使用清晰、描述性的名称
  • 避免空格(使用连字符或下划线)
  • 具体明确:使用“client-proposals”而非“docs”
  • 使用前缀排序:“01-current”、“02-archive”

File Naming

文件命名

  • Include dates: "2024-10-17-meeting-notes.md"
  • Be descriptive: "q3-financial-report.xlsx"
  • Avoid version numbers in names (use version control instead)
  • Remove download artifacts: "document-final-v2 (1).pdf" → "document.pdf"
  • 包含日期:“2024-10-17-meeting-notes.md”
  • 描述性命名:“q3-financial-report.xlsx”
  • 避免在文件名中使用版本号(改用版本控制工具)
  • 移除下载生成的冗余后缀:将“document-final-v2 (1).pdf”改为“document.pdf”

When to Archive

归档时机

  • Projects not touched in 6+ months
  • Completed work that might be referenced later
  • Old versions after migration to new systems
  • Files you're hesitant to delete (archive first)
  • 超过6个月未触碰的项目
  • 已完成但可能后续需要参考的工作
  • 迁移到新系统后的旧版本文件
  • 你不确定是否要删除的文件(先归档)