Note
The current code in this repository is AI-generated and not the original/real code.
As the developer, I plan to remove this placeholder code and replace it with the real implementation soon.
Auto Extension Switcher is a small Rust tool that automatically renames newly created files in a folder based on the user-selected file format.
This project helps practice Rust skills including filesystem monitoring, user input, error handling, and colored terminal output.
- Watch a folder for new file creations.
- Prompt the user to choose the desired file format (Rust, Python, HTML, JavaScript, C++).
- Automatically rename the file with the selected extension.
- Use colored output for better UX.
-
User runs the program:
autoext ./watched
-
Create a new file in
./watchedfolder. -
The program detects the file creation.
-
Prompts the user:
Which format do you want? (Rust, Python, HTML, JS, C++) -
User selects a format.
-
File is renamed automatically with the chosen extension.
-
MVP exits after processing the first file.
- notify → Watch a folder for new files.
- dialoguer → Nice CLI prompts for user input.
- anyhow → Simplified error handling.
- colored → Colored terminal output.
[package]
name = "autoext"
version = "0.1.0"
edition = "2021"
[dependencies]
dialoguer = "0.11.0"
notify = "8.2.0"
anyhow = "1.0.99"
colored = "3.0.0"-
Build the project:
cargo build --release
-
Run the program:
./target/release/autoext ./watched
-
Create a new file in the folder you are watching:
touch ./watched/new_file
-
Follow the terminal prompt to select the file format.
-
The file will be renamed automatically:
Renamed to: new_file.rs
- Continuous background monitoring (not exit after one file).
- Configurable custom extension mapping.
- File templates for each language.
- Multi-file batch handling.
- Cross-platform packaging for Windows, macOS, Linux.
- Detects a new file in the watched folder.
- Prompts user for file format.
- Renames file correctly.
- Works with colorized terminal output.
- Handles errors gracefully.