# hazelnut

> Terminal-based automated file organizer that watches folders and applies rules to move, copy, rename, or delete files based on patterns

Stars: 327 · Language: Rust · License: GPL-3.0 · Categories: File Management

- Repository: https://github.com/ricardodantas/hazelnut
- Website: https://hazelnut.ricardodantas.me/
- Page: https://www.trmn.sh/tools/hazelnut

## Install

- Homebrew: `brew install ricardodantas/tap/hazelnut`
- Cargo: `cargo install hazelnut`
- Arch Linux: `pacman -S hazelnut`

## Overview

Hazelnut is a terminal-based automated file organizer inspired by Hazel. It monitors specified directories for file changes and automatically applies user-defined rules to organize files based on conditions like filename patterns, extensions, size, age, and file type. The tool can move, copy, rename, delete, archive files, send them to trash, or execute custom scripts when conditions are met.

The tool provides both a TUI interface for real-time monitoring and rule management, and a background daemon (`hazelnutd`) that runs continuously. Rules support glob patterns and regex matching, multiple extension matching, size conditions (greater/less than specified bytes), and age-based filtering. Actions include moving files across filesystems, creating destination directories automatically, and variable substitution in rename patterns using tokens like `{date}`, `{name}`, and `{ext}`.

Configuration is managed through TOML files located at `~/.config/hazelnut/config.toml`. Watch folders can be configured with recursive monitoring and rule-specific filtering. The TUI includes 15 built-in themes, desktop notifications for errors, activity logging, and editors for both watch folders and rules. The daemon component is available on macOS and Linux, while Windows supports only the TUI interface.

### Installation

```bash
# via Homebrew
brew install ricardodantas/tap/hazelnut
```

```bash
# via Cargo
cargo install hazelnut
```

```bash
# via Arch Linux
pacman -S hazelnut
```

## Alternatives

- [notox](https://www.trmn.sh/tools/notox.md): CLI tool for renaming files to remove toxic or problematic characters from filenames (Rust, 16 stars)
- [xleak](https://www.trmn.sh/tools/xleak.md): Excel file viewer and interactive TUI for terminal with multi-sheet support and export capabilities (Rust, 1.5k stars)
- [viu](https://www.trmn.sh/tools/viu.md): Rust command-line image viewer for the terminal using the iTerm or Kitty graphics protocols, with a half-block fallback and animated GIF support. (Rust, 3.3k stars)
- [ouch](https://www.trmn.sh/tools/ouch.md): CLI tool for compressing and decompressing files across 14+ formats with automatic format detection (Rust, 3.8k stars)
- [xplr](https://www.trmn.sh/tools/xplr.md): Terminal-based file explorer with Lua scripting, keyboard controls, and plugin system for command-line integration (Rust, 4.8k stars)

---

Canonical: https://www.trmn.sh/tools/hazelnut
