A simple Python automation script that scans your Downloads folder, identifies files by extension, and automatically sorts them into category folders (Images, Documents, Videos, Archives, Code, Installers, Other).
This project demonstrates:
- File system navigation
- Working with paths (os, os.path)
- Moving files (shutil)
- Dictionaries and helper functions
- Tuple unpacking
- Basic automation scripting
- Automatically creates category folders if they don't exist
- Detects file extensions and assigns them to the correct category
- Moves files into their category folders
- Handles unknown extensions by placing them in an "Other" folder
- Clean, readable code with helper functions
- The script scans your Downloads directory.
- It extracts each file’s extension using os.path.splitext().
- A helper function (get_category) determines which category the extension belongs to.
- The script creates category folders if needed.
- Files are moved into their appropriate folders.
Follow these steps to run the organizer:
- Install Python 3.x on your system.
- Download or clone this repository.
- Open the script file "organizer.py".
- Update the DOWNLOADS_PATH variable to match your system’s Downloads folder path.
- Open a terminal or command prompt in the project folder.
- Run the script with: python organizer.py
Your Downloads folder will be sorted instantly.
You can customize the categories in the dictionary:
Anything not listed goes into "Others" folder.
EXTENSION_CATEGORIES = {
"Images": [".jpg", ".jpeg", ".png", ".gif", ".heic"],
"Documents": [".pdf", ".docx", ".txt", ".htm"],
"Videos": [".mp4", ".mov"],
"Archives": [".zip", ".rar"],
"Code": [".cpp", ".java", ".py"],
"Installers": [".exe", ".msi"],
}