extsort is a lightweight Python utility that organizes files in a folder based on their file extensions. It helps keep your workspace clean by grouping files into language- or type-specific folders like python, video, pdf, and more.
- Automatically organizes files into folders by extension
- Deletes executable files for cleanup (optional behavior)
- Skips files with no extension
- Easy to configure using .env and a customizable mapping
- Written in clean, modular Python
Before:
/myfolder
├── main.py
├── resume.pdf
├── video.mp4
├── notes.txt
├── installer.run
After running extsort
:
/myfolder
├── python/
│ └── main.py
├── pdf/
│ └── resume.pdf
├── video/
│ └── video.mp4
├── text_file/
│ └── notes.txt
Executable file
installer.run
is deleted.
git clone https://github.com/dakshcodez/extsort.git
cd extsort
pip install python-dotenv
Create a .env
file in the root directory:
FOLDER_PATH=/full/path/to/your/folder
python main.py
Edit the file_names.py
file to change how extensions map to folder names:
hash_map = {
".py": "python",
".pdf": "pdf",
".mp4": "video",
# add more as needed...
}
If an extension isn't listed, the file will go into an others/
folder.
- This script deletes executable files (
.exe
,.run
, etc.). You can disable or change this behavior inmain.py
. - Make sure your
FOLDER_PATH
is correct — this script moves and deletes files.
MIT License
Feel free to use, modify, and share.
- Make this a CLI tool
- Drag-and-drop folder input
- Add logging