PANOS is a high-performance, rule-based CLI file management tool engineered for speed and reliability. It transforms cluttered directories into perfectly structured hierarchies using a "set-and-forget" automation approach.
- β‘ Lightning Fast: High-performance directory traversal using
WalkDirand pre-compiled glob patterns for O(1) matching speed during execution. - π Intelligent Rule Engine: Support for both extension-based sorting and complex glob pattern matching (e.g.,
Invoice_*.pdf). - π§ͺ Safety First: Comprehensive
--dry-runmode and intelligent conflict resolution (automatic suffixing) to prevent data loss. - π Watch Mode: Real-time daemonized monitoring using
notify, automatically organizing files as they appear. - βͺ Smart Undo: Session-based undo functionality with parallelized restoration using
Rayonfor ultra-fast reversal of operations. - π§Ή Trash System: Specialized handling for temporary files (
.tmp,.crdownload,.cache), moving them to a dedicated.panos_trashfor safe review. - π³ Deep Clean: Recursive removal of empty directories after organization to keep your filesystem pristine.
- π§ AI Semantic Matching: Fallback mechanism using BERT-based embeddings to categorize files that don't match standard rules.
# Clone the repository
git clone https://github.com/Nonbangkok/panos.git
cd panos
# Build for release
cargo build --release# Run organization based on default panos.toml
./target/release/panos
# Preview changes without moving files
./target/release/panos --dry-run
# Watch a directory for changes and organize in real-time
./target/release/panos --watch --source ~/Downloads
# Undo the last organization session
./target/release/panos --undoTo enable AI semantic matching, you need to export the model assets using Python:
# 1. Create and activate a virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate
# 2. Install dependencies
pip install optimum[onnxruntime] transformers
# 3. Export the model to ONNX
python scripts/export_onnx.pyThis script will download bge-small-en-v1.5 and prepare it for use in Rust.
PANOS uses a simple TOML configuration to define how your files should be handled.
source_dir = "Downloads"
watch_mode = false # Can be overridden by --watch flag
[[rules]]
name = "Images"
extensions = ["jpg", "jpeg", "png", "gif"]
destination = "Media/Images"
[[rules]]
name = "Documents"
extensions = ["pdf", "docx", "txt"]
patterns = ["Invoice_*", "Report_*"]
destination = "Work/Documents"PANOS is built with a focus on efficiency and industrial-grade reliability:
- Pre-compiled Regex/Globs: Patterns are compiled once at startup, ensuring that millions of files can be matched without re-parsing overhead.
- Parallel Undo Engine: Leveraging
Rayon, PANOS restores files concurrently during undo operations, making session reversals instantaneous even for thousands of files. - Atomic Operations: Moves are designed to be as atomic as possible, with robust error recovery if a file is "In Use" or "Permission Denied".
- Session Logging: Every organization run logs its actions to a local
.panos_history.jsonfile, enabling persistent undo capabilities across different sessions. - Recursive State-Awareness: The scanner understands directory depth and ensures that empty branch nodes are pruned only after their children have been processed.
The project follows a modular Rust architecture for maintainability and scalability:
src/cli/: Command-line argument parsing and help template logic usingclap.src/config/: Configuration management, including loading and parsingpanos.toml.src/file_ops/: Core filesystem operations (move, delete, history logging).src/organizer/: The "Brain" β high-level scanning logic, watcher implementation, and undo orchestration.src/rules/: Intelligent matching engine for file extensions and patterns.src/ui/: TUI elements and progress reporting usingindicatif.src/lib.rs: Library entry point exposing core functionality.src/main.rs: CLI binary entry point.
- Safety: Leverage Rust's ownership model to ensure thread-safety and avoid race conditions.
- Modularity: Logic is strictly separated:
file_opshandles "how",ruleshandles "what". - Test-Driven: Comprehensive integration tests ensure that complex movement scenarios (conflicts, nested dirs, unicode) are handled correctly.
- Fork the repository.
- Create a feature branch:
git checkout -b feature/amazing-feature. - Standardize code style with
cargo fmt. - Ensure all tests pass:
cargo test. - Submit a Pull Request.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.
PANOS - Organizing the chaos, one file at a time.
