Week 03 - CLI File Organiser
February 19, 2026
1 min read
by Jim
RustProjectCLIFile Organisation
See original block post here.
For the third week of my uni project challenge, I built a CLI file organiser using Rust. This tool helps users quickly organise their files into folders based on their file extension.
Features
- Organises files in a specified directory into folders based on their sort option (e.g., by file extension, by date, and size)
- Supports selecting directories and excluding specific files or patterns
- Optional prefix for sorted folders to avoid naming conflicts (e.g., "Sorted_")
- Dry-run mode to preview changes without modifying files
Usage
To use the CLI file organiser, you can run the following command in your terminal: (using release)
./cli-file-organiser --help
Usage: cli-file-organiser [OPTIONS]
Options:
-d, --directory <DIRECTORY> Directory to sort (default: current directory) [default: .]
-e, --exclude <EXCLUDE>... Files to exclude (e.g. 'file.txt' or '*.txt')
-p, --prefix <PREFIX> Prefix for new directories (e.g. 'Sorted_') [default: ]
-s, --sort <SORT> How should files be sorted? [default: type] [possible values: type, date, size]
--dry-run Don't actually move files, just show what would be done
-h, --help Print helpFor example, to organise files in the "Downloads" folder by type, excluding any .txt files, and adding a "Sorted_" prefix to the new folders, you would run:
./cli-file-organiser -d ~/Downloads -e "*.txt" -p "Sorted_"Running this project
Clone the repository and navigate to the project directory:
git clone https://github.com/Jimster4312/rust-cli-file-organiser.git
cd rust-cli-file-organiserInstall the dependencies:
cargo build --releaseTest the CLI tool:
./target/release/cli-file-organiser --helpThis will display the help message with usage instructions. You can then use the CLI tool to organise your files as needed.
Thanks for checking out my project!