Skip to content

Janmesh23/rust-file-organizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦€ Rust File Organizer CLI

A powerful command-line tool built with Rust that automatically organizes files in your directories based on their types, extensions, or custom rules.

πŸš€ Features

  • Smart File Organization: Automatically sort files by extension, file type, or date
  • Custom Rules: Define your own organization patterns
  • Safe Operations: Preview changes before applying them
  • Undo Functionality: Revert organization operations
  • Multiple Organization Modes:
    • By file extension (images, documents, videos, etc.)
    • By file size (small, medium, large)
    • By creation/modification date
    • By custom patterns
  • Cross-Platform: Works on Windows, macOS, and Linux
  • Fast & Memory Efficient: Built with Rust's performance in mind

πŸ› οΈ Installation

From Source

git clone https://github.com/Janmesh23/rust-file-organizer.git
cd rust-file-organizer
cargo build --release
cargo install --path .

Using Cargo

cargo install file-organizer

πŸ“‹ Usage

Basic Commands

# Organize current directory by file extension
file-organizer organize

# Preview organization without making changes
file-organizer organize --dry-run

# Organize specific directory
file-organizer organize /path/to/directory

# Organize by file size
file-organizer organize --mode size

# Organize by date
file-organizer organize --mode date

# Undo last organization
file-organizer undo

# Show help
file-organizer --help

Organization Modes

By Extension (Default)

file-organizer organize
# Creates folders: Images/, Documents/, Videos/, Audio/, Archives/, etc.

By Size

file-organizer organize --mode size
# Creates folders: Small/, Medium/, Large/

By Date

file-organizer organize --mode date
# Creates folders: 2024-01/, 2024-02/, etc.

Custom Rules

file-organizer organize --config custom-rules.toml

πŸ“ File Type Categories

Category Extensions
Images .jpg, .jpeg, .png, .gif, .bmp, .svg, .webp
Documents .pdf, .doc, .docx, .txt, .md, .rtf
Videos .mp4, .avi, .mkv, .mov, .wmv, .flv
Audio .mp3, .wav, .flac, .aac, .ogg, .m4a
Archives .zip, .rar, .7z, .tar, .gz, .bz2
Code .rs, .js, .py, .java, .cpp, .c, .go
Spreadsheets .xlsx, .xls, .csv, .ods

βš™οΈ Configuration

Create a config.toml file to customize organization rules:

[general]
create_date_folders = true
backup_enabled = true
max_folder_depth = 3

[extensions]
# Custom extension mappings
[extensions.my_images]
folder = "MyImages"
extensions = ["jpg", "png", "custom_ext"]

[extensions.work_docs]
folder = "WorkDocuments"
extensions = ["docx", "xlsx", "pptx"]

[size_limits]
small = "10MB"
medium = "100MB"
# Files larger than medium go to "Large"

[ignore]
# Files/folders to ignore
patterns = [".git", "node_modules", "*.tmp"]

πŸ“š Documentation

Comprehensive documentation is available in the docs/ directory:

πŸ”§ Quick Start

Prerequisites

  • Rust 1.70.0 or higher
  • Cargo

Building

git clone https://github.com/Janmesh23/rust-file-organizer.git
cd rust-file-organizer
cargo build --release

Running

# Show help
cargo run -- --help

# Preview organization (safe)
cargo run -- organize --dry-run

# Organize by file type
cargo run -- organize ~/Downloads --dry-run

# Organize by file size
cargo run -- organize --mode size --dry-run

Testing

cargo test

πŸ“– Examples

Organize Downloads Folder

# Preview what would happen
file-organizer organize ~/Downloads --dry-run

# Actually organize
file-organizer organize ~/Downloads

# Undo if needed
file-organizer undo ~/Downloads

Custom Organization

# Organize only image files
file-organizer organize --filter images

# Organize files older than 30 days
file-organizer organize --older-than 30d

# Organize but keep original structure for specific types
file-organizer organize --preserve code,documents

🚧 Roadmap

  • Phase 1: Core Functionality

    • Basic file organization by extension
    • Preview mode (--dry-run)
    • Undo functionality
    • Configuration file support
  • Phase 2: Advanced Features

    • Organization by file size
    • Organization by date
    • Custom rules engine
    • Duplicate file detection
  • Phase 3: UI & UX

    • Interactive mode
    • Progress bars
    • Colored output
    • Watch mode (auto-organize)
  • Phase 4: Integrations

    • Shell completions
    • GUI version
    • Cloud storage integration

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ› Bug Reports

If you find a bug, please create an issue with:

  • Rust version (rustc --version)
  • Operating system
  • Command that caused the issue
  • Expected vs actual behavior

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Built with ❀️ using Rust
  • Inspired by the need for better file organization
  • Thanks to the Rust community for amazing crates

πŸ“Š Project Stats

  • Language: Rust πŸ¦€
  • Type: CLI Application
  • License: MIT
  • Status: In Development

Made with πŸ¦€ Rust by Janmesh23

About

πŸ¦€ A powerful CLI tool built with Rust to organize files by type, size, date, or custom rules

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages