A Python-based automation tool that organizes files in a directory by categorizing them into folders based on file extensions. This project simplifies file management and improves productivity by reducing manual sorting.
- Automatically categorizes files by type (Images, Documents, Videos, etc.)
- Creates folders dynamically if they don’t exist
- Safely moves files without overwriting existing ones
- Displays real-time logs of file movements
- Works seamlessly on Windows (via WSL) and Linux
- Language: Python 3
- Modules Used:
os,shutil
| Category | File Extensions |
|---|---|
| Images | .jpg, .jpeg, .png, .gif |
| Documents | .pdf, .docx, .txt, .pptx |
| Videos | .mp4, .mkv, .avi |
| Music | .mp3, .wav |
| Programs | .py, .java, .cpp, .exe |
| Others | All uncategorized files |
Downloads/
├── Images/
├── Documents/
├── Videos/
├── Music/
├── Programs/
└── Others/
- Scans all files in the target directory
- Identifies file extensions
- Matches extensions with predefined categories
- Creates required folders automatically
- Moves files safely into respective folders
git clone https://github.com/your-username/python-file-organizer.git
cd python-file-organizerIn file_organizer.py, set the folder you want to organize:
TARGET_FOLDER = "/mnt/c/Users/Shirivarshini A/Downloads"If using Windows + WSL, always use
/mnt/c/path format.
python file_organizer.py📂 Organizing files in:
➡️ /mnt/c/Users/Shirivarshini A/Downloads
✅ resume.pdf → Documents/
✅ image.png → Images/
📦 random.xyz → Others/
🎉 File organization completed successfully!
- Prevents overwriting files with the same name
- Renames duplicates automatically (e.g.,
file_1.txt) - Skips existing directories
- Command-line arguments support
- GUI version using
tkinter - Date-wise or size-based organization
- Config file for custom extensions
- Auto-run using task scheduler / cron jobs
- Organizing Downloads folder
- Cleaning project directories
- Automating file management tasks
- Beginner-friendly Python automation project
This project is open-source and free to use for learning and personal projects.
Shirivarshini A | Tech Enthusiast