pipeline status

Organize files based on regex rules, file extensions by default.

Installation

Using cargo (require Rust)

Install it by running bash $ cargo install organize-rt

It will download & compile binary to ~/.cargo/bin. Add this directory to your path or copy binary to /usr/bin/

Compiling from source (require Rust)

Just clone this repo and build this project: bash $ git clone --depth=1 https://gitlab.com/FixFromDarkness/organize-rt.git $ cd organize-rt $ cargo build --release

After compiling, you can use binary ./target/release/organize-rt. For example, you could copy it to /usr/bin.

Using pre-build binaries

Download binaries from GitLab release section.

Arch Linux

Clone repo and use makepkg: bash $ git clone --depth=1 https://gitlab.com/FixFromDarkness/organize-rt.git $ makepkg -sri

Fedora/CentOS

Available in COPR: sudo dnf copr enable atim/organize-rt -y sudo dnf install organize-rt

Usage

``` $ organize-rt --help organize-rt 1.0.0 Tool for organizing files in garbage dirs like 'Downloads'

USAGE: organize-rt [FLAGS] [OPTIONS] --output --source

FLAGS: --dry-run Prints where the file would move, but does not move -h, --help Prints help information -H, --hidden Include hidden files/directories -q, --quiet Quiet run, empty output -r, --recursive -u, --undo Undo action (require log) -V, --version Prints version information -v, --verbose Show more info

OPTIONS: --log Path to save/load log [default: ./organize-rt.log] -o, --output Output directory -s, --source Directory to organize ```

Recommended mode: organize-rt -rH

When you run this program, after all moves it will save its actions in log (--log option, default "./organize-rt.log"). If you want to discard changes, run with --undo option. For example organize-rt --undo --log ./badrun.log will discard changes, saved in badrun.log. Some important notes about undo: * It use absolute paths, so you can run it from anywhere. * Due to absolute paths, you can't undid changes if output dir was moved * It will skip errors (deleted files from output dir) * You can delete source directory, undo mode will restore it

Example

Normal mode: $ organize-rt -s in -o out -rH --dry-run in/avi.avi -> out/Video/avi.avi in/compressed.tar.bz2 -> out/Compressed/compressed.tar.bz2 in/ogg.ogg -> out/Audio/ogg.ogg in/conf.conf -> out/Configuration/conf.conf in/archlinux.iso -> out/ISO/archlinux.iso in/compressed.tar.gz -> out/Compressed/compressed.tar.gz in/dir/document.docx -> out/Documents/document.docx in/dir/image.png -> out/Images/image.png in/unsorted.norule -> out/Unsorted/unsorted.norule in/.hidden.conf -> out/Configuration/.hidden.conf in/mp3.mp3 -> out/Audio/mp3.mp3

Undo this action (# hide absolute path): ``` $ organize-rt --undo --dry-run

/out/Video/avi.avi -> #/in/avi.avi

/out/Compressed/compressed.tar.bz2 -> #/in/compressed.tar.bz2

/out/Audio/ogg.ogg -> #/in/ogg.ogg

/out/Configuration/conf.conf -> #/in/conf.conf

/out/ISO/archlinux.iso -> #/in/archlinux.iso

/out/Compressed/compressed.tar.gz -> #/in/compressed.tar.gz

/out/Unsorted/unsorted.norule -> #/in/unsorted.norule

/out/Audio/mp3.mp3 -> #/in/mp3.mp3

```

Writing own rules

Just edit ~/.config/organize-rt/organize-rt.toml. This file will appear after the first run, you can also use organize-rt.toml.default from this repository. File structure: ```toml rules = [

...

[
'REGEX',
'OUTPUT_SUBDIR',

]

...

] ``` With this rule, file, that match REGEX rule, but didn't match previous rules will move to OUTPUTDIR/OUTPUTSUBDIR, where OUTPUT_DIR is --output option.

Like it?

Star this repo, please.

Bad code?

Waiting for your pull request or issue