Welcome to the File Organizer project! This Go script automatically organizes the contents of your Downloads folder into predefined categories (Documents, Videos, Audio, Pictures, etc.). It moves any files it recognizes into a “Downloaded ___” folder within the appropriate directory, all based on file extensions.
-
Future-Proof File Paths:
Automatically locates a user’s home directory and derives all needed paths (Documents, Videos, Music, Pictures, Others) without any hardcoding. -
Comprehensive File Categories:
Groups files by extensions for Documents, Videos, Audio, and Pictures. Customize it by adding or removing categories in thefileCategories
map. -
Car-Themed Easter Egg:
Keep an eye out for the fun tribute to endurance racing and cars! -
Developer-Friendly:
Code is structured to mix simple OOP practices with functional helpers, ensuring clarity and maintainability. -
Startup Execution:
Optionally run the program at system startup to keep your downloads sorted automatically.
-
Prerequisites
- Go (1.18 or higher recommended)
- A computer running Windows, macOS, or Linux
-
Download or Clone This Repo
git clone https://github.com/setsudan/file-organizer-go.git cd file-organizer-go
-
Build the Executable
go build -o file-organizer
-
On Windows, you may want to hide the console window:
go build -ldflags="-H=windowsgui" -o file-organizer.exe
-
-
Run the Script
./file-organizer
The script will:
- Look in your Downloads folder
- Identify each file’s category
- Move files to a
Downloaded [Category]
folder inside Documents, Videos, Music, Pictures, or Others.
- Generate Executable (see above).
- Open Your Startup Folder
Press Win + R, typeshell:startup
, and hit Enter. - Place or Link the compiled
.exe
in this folder.
Your file organizer will now run automatically every time you log in, quietly sorting your downloads.
- File Categories
Open the script and locate thefileCategories
map. Add or remove extensions as you see fit. - Directory Paths
If you want to change the target folders, edit the code where it assignsdocDir
,videoDir
, etc. But by default, it uses system directories in your home folder. - Logging / Feedback
Feel free to adjust or remove the console output for a more silent experience.
Feel free to fork this repository and submit pull requests with improvements:
- Adding new categories
- Improving file extension coverage
- Enhancing code clarity
- Expanding OS compatibility
This project is distributed under the MIT License. Please see the LICENSE file for details.