Tired of Having Messy Files? Let’s Organize Them!
This Python script helps you organize your files into folders like Documents, Images, and so on. Plus, if you want, it can rename your .txt
files using AI (powered by the Google Gemini 1.5 Flash API), so your files have more meaningful names based on their content.
- Organizes your files into folders based on their type (Documents, Images, etc.).
- Lets you choose which folder to organize with the
--path
argument. - Option to rename
.txt
files using AI. - Displays a quick summary of what was organized.
- Clean code with separate sections for scanning, moving, renaming, and showing results.
-
Clone the repo (or download the project):
git clone <repo_url> cd <repo_directory>
-
Install dependencies:
Make sure you have Python 3.6+ installed. Then, run:
pip install google
-
Run the script with the
--path
option to specify the folder to organize:python main.py --path "C:\Users\YourName\Downloads"
If you don’t provide the
--path
argument, it will default to the folder you're currently in. -
When it’s done scanning, you’ll get this prompt:
Enter 'yes' to use AI to rename files, or 'no' to skip:
If you want, you can use the AI feature to rename .txt
files. The script will send the content of those files to Google Gemini 1.5 Flash API, and the AI will suggest a new name based on the file’s content.
- You’ll need an API key from Google Gemini to use this feature.
- Only
.txt
and.json
files are supported for AI renaming right now.
file-organizer/
│
├── main.py # Main entry point for running the program
├── organizer/
│ ├── scanner.py # Scans and categorizes files
│ ├── mover.py # Moves files into folders
│ ├── renamer.py # Optionally renames files using AI
│ └── display.py # Shows a summary of the organized files
└── README.md # This file
-
Python 3.6+
-
Install the required libraries:
pip install google
MIT License. Feel free to use and modify as needed.
If you spot any bugs or have ideas for improvement, feel free to open an issue or send a pull request.
Before running the script, your Downloads
folder might look something like this:
Downloads/
├── image1.jpg
├── document1.txt
├── video.mov
After running the script, the files will be organized into the right folders:
Downloads/
├── Images/
│ └── image1.jpg
├── Documents/
│ └── document1.txt
├── videos/
│ └── video.mov
And if you choose to use the AI renaming feature, your .txt
file might be renamed like this:
Before AI renaming:
document1.txt
After AI renaming:
SuggestedTitleFromAI.txt
- Scanning: The script scans the folder and categorizes files by type (like Documents, Images, etc.).
- Moving: It then moves the files into the right folders.
- Renaming: If you choose, it will use the AI to rename
.txt
files based on their content. - Summary: Finally, it shows you a summary of everything that was organized and renamed.
python main.py --path "C:\Users\YourName\Downloads"