organize

tfeldmannMIT活跃维护

用 YAML 规则自动整理文件:按扩展名、日期、内容等条件把下载目录、文档归档等杂乱文件移动、重命名、删除或归档,省去手动分类。

The file management automation tool.

v3.3.0发布于 2024-11-25 15:28 UTC3,191star +3 / 7 天201fork同步于 2026-11-10 17:43 UTC

怎么上手

由 README 提炼,执行前请确认
pip install -U organize-tool
organize new && organize edit
organize run
硬件要求按 README 说明

README 未说明,仅需 Python 3.9+,可在 macOS、Windows、Linux 上运行

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

命令行文件管理自动化工具,用 YAML 规则批量整理、重命名、去重文件

用 YAML 规则自动整理文件:按扩展名、日期、内容等条件把下载目录、文档归档等杂乱文件移动、重命名、删除或归档,省去手动分类。

核心能力

  • 用 YAML 规则定义位置、过滤器与动作
  • 支持安全移动、重命名、复制并处理冲突
  • 基于文件内容提取 EXIF 与 PDF/DOCX 文本分类
  • 内置快速重复文件检测
  • 支持内联 Python 与 shell 命令扩展

容易踩的坑

PyPI 包名是 organize-tool,不是 organize;需要先运行 organize new 生成 config.yaml 再编辑;建议先用 organize sim 模拟,确认无误再 organize run

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v3.3.0
  1. v3.3.0最新正式版2024-11-25 · 2024-11-25 15:28 UTC
    • Added a new conflict mode deduplicate which skips duplicate files and renames non-duplicates (thanks @TheExistingOne).
    • The exif filter now supports extracting metadata from non-image files such as EPUB or PDF files.
    • Loosen the pdfminer-six dependency version constraint for easier NixOS packaging.
    • Fixes encoding issues in windows (thanks @Alimektor).
  2. v3.2.52024-07-09 · 2024-07-09 13:43 UTC
    查看更新说明
    • Fixes a bug where some location options did not accept yaml aliases (#390, thanks for reporting @zany130).
  3. v3.2.42024-07-07 · 2024-07-07 11:53 UTC
    查看更新说明
    • Fixes a bug preventing organize from starting (thanks @feather42).
    • Fixes a bug where ignoring failing shell commands would not work (thanks @florianklumb).
  4. v3.2.32024-03-29 · 2024-03-29 14:48 UTC
    查看更新说明
    • Improves the logic of finding and creating config files.
    • Fixes a bug where config files in XDG_CONFIG_HOME are not found (#371).
    • Fixes a bug in the relative_path parameter crashing on actions after moving files (#372).
  5. v3.2.22024-03-04 · 2024-03-04 14:09 UTC
    查看更新说明
    • Fixes a problem where the organize new command fails to create a new config file. (#359)

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译


    v3 is now available

    The new version should be much faster and fix a lot of bugs. It also comes with a some new actions, filters and options.

    If you encounter any other bugs or problems during the migration, please reach out!

    About

    Your desktop is a mess? You cannot find anything in your downloads and documents? Sorting and renaming all these files by hand is too tedious? Time to automate it once and benefit from it forever.

    organize is a command line, open-source alternative to apps like Hazel (macOS) or File Juggler (Windows).

    People use this for:

    • Sorting and tagging pictures into various folder structures based on EXIF data
    • Sorting and renaming PDF invoices based on file content
    • Removing incomplete downloads from their ~/Downloads
    • Cleaning up their ~/Desktop from unused files
    • Freeing up disk space by removing duplicates
    • Automating various business processes
    • and many more

    Features

    Some highlights include:

    • Safe moving, renaming, copying of files and folders with conflict resolution options.
    • Fast duplicate file detection.
    • Exif tags extraction.
    • Categorization via text extracted from PDF, DOCX and many more.
    • Powerful template engine.
    • Inline python and shell commands as filters and actions for maximum flexibility.
    • Everything can be simulated before touching your files.
    • Works on macOS, Windows and Linux.
    • Free and open source software.

    Getting started

    Installation

    Only python 3.9+ is needed. Install it via your package manager or from python.org.

    Installation is done via pip. Note that the package name is organize-tool:

    pip install -U organize-tool
    

    This command can also be used to update to the newest version. Now you can run organize --help to check if the installation was successful.

    Create your first rule

    In your shell, run organize new and then organize edit to edit the configuration:

    rules:
      - name: "Find PDFs"
        locations:
          - ~/Downloads
        subfolders: true
        filters:
          - extension: pdf
        actions:
          - echo: "Found PDF!"
    

    If you have problems editing the configuration you can run organize show --reveal to reveal the configuration folder in your file manager. You can then edit the config.yaml in your favourite editor.

    save your config file and run:

    organize run
    

    You will see a list of all .pdf files you have in your downloads folder (+ subfolders). For now we only show the text Found PDF! for each file, but this will change soon... (If it shows Nothing to do you simply don't have any pdfs in your downloads folder).

    Run organize edit again and add a move-action to your rule:

    actions:
      - echo: "Found PDF!"
      - move: ~/Documents/PDFs/
    

    Now run organize sim to see what would happen without touching your files.

    You will see that your pdf-files would be moved over to your Documents/PDFs folder.

    Congratulations, you just automated your first task. You can now run organize run whenever you like and all your pdfs are a bit more organized. It's that easy.

    There is so much more. You want to rename / copy files, run custom shell- or python scripts, match names with regular expressions or use placeholder variables? organize has you covered. Have a look at the advanced usage example below!

    Example rules

    Here are some examples of simple organization and cleanup rules. Modify to your needs!

    Move all invoices, orders or purchase documents into your documents folder:

    rules:
      - name: "Sort my invoices and receipts"
        locations: ~/Downloads
        subfolders: true
        filters:
          - extension: pdf
          - name:
              contains:
                - Invoice
                - Order
                - Purchase
              case_sensitive: false
        actions:
          - move: ~/Documents/Shopping/
    

    Recursively delete all empty directories:

    rules:
      - name: "Recursively delete all empty directories"
        locations:
          - path: ~/Downloads
        targets: dirs
        subfolders: true
        filters:
          - empty
        actions:
          - delete
    

    You'll find many more examples in the full documentation.

    Command line interface

    organize - The file management automation tool.
    
    Usage:
      organize run   [options] [<config>]
      organize sim   [options] [<config>]
      organize new   [<config>]
      organize edit  [<config>]
      organize check [<config>]
      organize debug [<config>]
      organize show  [--path|--reveal] [<config>]
      organize list
      organize docs
      organize --version
      organize --help
    
    Commands:
      run        Organize your files.
      sim        Simulate organizing your files.
      new        Creates a new config.
      edit       Edit the config file with $EDITOR.
      check      Check whether the config file is valid.
      debug      Shows the raw config parsing steps.
      show       Print the config to stdout.
                   Use --reveal to reveal the file in your file manager
                   Use --path to show the path to the file
      list       Lists config files found in the default locations.
      docs       Open the documentation.
    
    Options:
      <config>                        A config name or path to a config file
      -W --working-dir <dir>          The working directory
      -F --format (default|jsonl)     The output format [Default: default]
      -T --tags <tags>                Tags to run (eg. "initial,release")
      -S --skip-tags <tags>           Tags to skip
      -h --help                       Show this help page.
    

    Other donation options:

    ETH:

    0x8924a060CD533699E230C5694EC95b26BC4168E7
    

    BTC:

    39vpniiZk8qqGB2xEqcDjtWxngFCCdWGjY