Small Python app that cleans up a messy folder by moving files into subfolders based on their type. Images end up in Images, PDFs in Documents, mp3s in Audio, and so on.
You need Python 3.8 or newer. Everything the code uses is in the standard library so there is nothing to pip install. On Linux you might need sudo apt install python3-tk if tkinter is not already there.
git clone https://github.com/tsarumar/Smart-File-Organizer.git
cd Smart-File-Organizer
python main.py
The window opens, you pick a folder with Browse, hit Start, and watch the log fill up. If you don't like the result, Undo last or Undo all puts everything back.
Empty window:
After a run on a folder with a mix of files:
The log it keeps in organizer.log:
Each class has one job.
classifier.pydecides which category a file belongs to, based on its extension.logger.pywrites moves toorganizer.logwith timestamps.history.pyrecords every move tohistory.jsonso undo works.organizer.pyglues them together and does the actual moving withshutil.move.gui.pyis the tkinter window.main.pyopens the window.
Extensions get grouped into Images, Documents, Audio, Video, Archives, Code, Executables and Fonts. Anything not in those lists ends up in Other. You can also add rules at runtime with FileClassifier.add_rule().
If a file with the same name already exists at the destination the new one gets _1, _2, etc. appended so nothing gets overwritten. Permission errors and other OS errors get caught, logged, and skipped, so one weird file cannot stop the whole run.
The GUI runs the work in a background thread. Without that the window would freeze while files move. Stop uses the same idea: the button flips a flag the worker checks between files.


