A simple CLI tool written in Go that organizes files in a directory by moving them into categorized subfolders based on their extensions.
- Automatically sorts files into predefined categories (Images, Videos, Documents, Archives, etc.).
- Customizable sorting rules via configuration.
- CLI-based with simple usage.
- Efficient and lightweight.
- Clone the repository:
git clone https://github.com/yourusername/file-organizer.git cd file-organizer
- Initialize the Go module:
go mod init file-organizer go mod tidy
- Build the executable:
go build -o file-organizer main.go
Run the program with a directory path to organize:
./file-organizer --path ~/Downloads
🔄 Organizing files in: ~/Downloads
📂 Moved image1.jpg → Images
📂 Moved video.mp4 → Videos
📂 Moved document.pdf → Documents
✅ Organization complete!
You can define custom sorting rules in a config.json
file:
{
"Images": [".jpg", ".jpeg", ".png", ".gif"],
"Videos": [".mp4", ".mkv", ".mov"],
"Documents": [".pdf", ".docx", ".txt"],
"Archives": [".zip", ".rar", ".tar.gz"]
}
- Implement a watch mode to automatically organize new files.
- Add GUI support for easier interaction.
- Support multi-threading for faster processing.
This project is open-source and available under the MIT License.