Skip to content

kklimas/regsort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RegSort - File Organizer πŸ—‚οΈ

RegSort is a simple and efficient command-line tool designed to help you organize your files based on custom patterns and rules. It automatically sorts files in your selected folder into predefined directories based on regex patterns.

πŸš€ Features

  • βœ… Automatically move files based on regex patterns defined in a configuration file.
  • πŸ” Support for file types, file names, and other pattern-based rules.
  • πŸ§ͺ Supports "dry-run" mode to simulate the file organization without making changes.
  • βš™οΈ Customizable configuration to easily define your sorting rules.
  • πŸ“ Log every action taken for traceability and debugging.
  • πŸ“‚ Create target directories if they don't exist.

πŸ› οΈ How it Works

RegSort watches a specified directory and organizes files into folders based on rules you define in a TOML configuration file. Each rule consists of:

  • A regex pattern that matches the file name or type.
  • A target directory where files matching the pattern will be moved.

For example, you can configure it to move .pdf files into a Documents/Invoices folder and .exe files into a Documents/Programs folder.


πŸ“ Configuration Example

The configuration file (config.toml) is simple and flexible. Here is an example:

[config]
source_dir = "in"
dry_run = false
log = true

[[rules]]
pattern = ".*\\.txt"
target = "out/txt"

[[rules]]
pattern = ".*\\.csv"
target = "out/csv"

The above configuration

  • set source dir to /in
  • does not set dry-run mode - changes will be applied
  • set log level to DEBUG
  • moves .txt files from /in/* to out/txt directory
  • moves .csv files from /in/* to out/csv directory

πŸŽ¬β€ Usage Example

Within this repository run

export REG_SORT_CONFIG=config.toml

And then

cargo run

Add .txt file to /in repo. It should be moved to out/txt.

About

Pattern based tool for organising your files.

Topics

Resources

Stars

Watchers

Forks

Languages