Skip to main content

Rule-based file operations engine for Linux

Project description

Flume

CI PyPI

A rule-based file operations engine for Linux. Define rules in YAML -- when files matching patterns appear in watched directories, Flume executes actions: move, copy, rename, convert, sync, archive, deduplicate.

Think Hazel for macOS, but CLI-first, config-driven, no AI, no cloud dependency.

Features

  • Watch directories for new files/folders via inotify
  • Pattern matching with glob and regex support
  • Size filtering -- match files by min/max size
  • Actions: move, copy, rename, trash, run shell commands, unzip, desktop notifications
  • Rule chaining -- output of one action feeds the next
  • One-shot or daemon mode -- run once or watch continuously
  • Dry-run mode -- preview what would happen without touching anything
  • Summary reports -- export dry-run results as text, JSON, or CSV
  • Structured logging -- every operation logged with timestamps
  • Config validation -- catch errors before they bite

Installation

pip install flume-engine

Or install from source:

git clone https://github.com/mattWoolly/Flume.git
cd Flume
pip install .

Quick Start

Create ~/.config/flume/rules.yaml:

rules:
  - name: organize-downloads
    watch: ~/Downloads
    match:
      pattern: "*.pdf"
    actions:
      - move: ~/Documents/PDFs/

Then run:

# Preview what would happen
flume run --dry-run

# Run once against existing files
flume run

# Or watch continuously for new files
flume watch

Configuration

Rules live in ~/.config/flume/rules.yaml:

rules:
  - name: archive-zips
    watch: ~/Downloads
    match:
      pattern: "*.zip"
    actions:
      - unzip:
          dest: ~/Documents/extracted/
      - trash-original: true

  - name: organize-screenshots
    watch: ~/Pictures/Screenshots
    match:
      pattern: "*.png"
    actions:
      - rename: "{date:%Y-%m-%d}_{original}"
      - move: ~/Pictures/Screenshots/organized/

  - name: large-file-alert
    watch: ~/Downloads
    match:
      pattern: "*"
      min_size: 1GB
    actions:
      - notify:
          title: "Large download"
          body: "File arrived: {name}"
          urgency: critical

  - name: cleanup-old-logs
    watch: /var/log/myapp
    match:
      pattern: "*.log"
      older_than: 30
    actions:
      - compress:
          dest: /var/log/myapp/archive/
      - trash-original: true

Running as a Service

Flume ships a systemd user unit in contrib/flume.service. To install it:

# Copy the unit file
mkdir -p ~/.config/systemd/user
cp contrib/flume.service ~/.config/systemd/user/

# Enable and start
systemctl --user daemon-reload
systemctl --user enable flume
systemctl --user start flume

# Check status
systemctl --user status flume

# View logs
journalctl --user -u flume -f

This runs flume watch under your user session. It restarts automatically on failure and starts on login. Make sure flume is installed to ~/.local/bin (i.e. pip install --user -e . or pip install -e . in a virtualenv on your PATH).

To keep it running after logout (on a server, for example):

loginctl enable-linger $USER

Architecture

flume/
  cli.py          # CLI entry point (click)
  config.py       # YAML config loading and validation
  watcher.py      # inotify filesystem watcher
  matcher.py      # Pattern/rule matching engine
  actions/        # Action implementations
    move.py
    copy.py
    rename.py
    trash.py
    unzip.py
    shell.py
    notify.py
  engine.py       # Rule execution engine
  log.py          # Structured logging

Requirements

  • Python 3.10+
  • Linux (inotify-based; macOS/BSD support planned)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flume_engine-1.0.1.tar.gz (45.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flume_engine-1.0.1-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file flume_engine-1.0.1.tar.gz.

File metadata

  • Download URL: flume_engine-1.0.1.tar.gz
  • Upload date:
  • Size: 45.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flume_engine-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5d22883dbe0b603cf1ba638e587e233a93b92e3c75579a1bcc7fa419cb9acc60
MD5 ba0f0cbbe14de2c9f93bd0e97742c174
BLAKE2b-256 f3072ec4f46d80599978138ec72f2abbe6e5abfc41d58904fb73de901ab9b159

See more details on using hashes here.

Provenance

The following attestation bundles were made for flume_engine-1.0.1.tar.gz:

Publisher: publish.yml on mattWoolly/Flume

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flume_engine-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: flume_engine-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flume_engine-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c705dc19a598e0d87a22194ff030292164b4fb03da91fb9e3b2352a3c29d16cf
MD5 0f1a9a7fde920773538a965a715f1e46
BLAKE2b-256 1a939187a518a34a06e117c6532ce9758bcadc4d5b72a5d032aae793c045eb8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for flume_engine-1.0.1-py3-none-any.whl:

Publisher: publish.yml on mattWoolly/Flume

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page