DEV Community

Medha Sunkad
Medha Sunkad

Posted on

Building an AI File Organizer with Python, Ollama, and Gemma 3

Building an AI File Organizer with Python, Ollama, and Gemma 3
For Hacktoberfest 2026 Week 3, themed Slow and Steady, I built an AI File Organizer using Python and local AI.

The goal was simple: organize files into appropriate folders based on their file types, while exploring how a locally running AI model can assist with file classification.
What does the project do?
The AI File Organizer scans a designated folder and sorts files into categories.

The categories include:

  • Documents — PDF, DOCX, TXT, and spreadsheet files
  • Images — JPG, PNG, GIF, and other image formats
  • Media — audio and video files
  • Code — Python, JavaScript, Java, and other programming files
  • Other files — files that don't match the supported categories The application previews the proposed file movements and asks for confirmation before organizing files. It also handles duplicate filenames to avoid overwriting existing files. Technologies used
  • Python — core application logic
  • Ollama — runs the AI model locally
  • Gemma 3 (1B) — assists with classifying unfamiliar file types
  • Git and GitHub — version control and project hosting How does the AI work? I used a hybrid approach.

For common file extensions, the application uses predefined rules. For unfamiliar extensions, it asks the local Gemma model for a category suggestion.

The model's response is validated against the allowed categories. If the response is invalid or an error occurs, the application falls back to Other files.

This approach taught me that AI can be useful without having to control every part of an application. Combining deterministic rules with AI suggestions makes the system more predictable.
Challenges and learnings
One challenge was that the AI model did not always return the expected category. I learned to validate model outputs instead of trusting them blindly.

I also implemented a preview-before-move workflow and tested duplicate filename handling.

This project helped me practise Python file handling, exception handling, working with a local AI model, and using Git for version control.
Project repository
🔗 GitHub: https://github.com/MedhaSunkad13/AI-File-Organizer

What's next?
I would like to improve the project with better classification, additional file categories, and more comprehensive tests.

Building this project reminded me that consistent progress, even through small steps, can lead to a working application.

I'd love to hear suggestions from the community!

Top comments (0)