A powerful and user-friendly tool to automatically organize your files into categorized folders based on their file types. Available in both command-line and GUI versions for maximum flexibility.
- Smart Categorization: Automatically sorts files into predefined categories (Documents, Images, Videos, Music, etc.)
- Dual Interface: Choose between command-line automation or intuitive GUI
- Safe Operations: Files are moved (not copied) with duplicate handling and no overwriting
- Progress Tracking: Real-time progress bar and detailed results summary in GUI mode
- Comprehensive Logging: All operations logged for troubleshooting and verification
- Cross-Platform: Works seamlessly on Windows, macOS, and Linux
- Flexible: Handles unknown file types by creating extension-based folders
- Python 3.6 or higher
- tkinter (included with most Python installations)
Check your Python version:
python --version- Clone or download the project files
- Navigate to the project directory
Perfect for batch processing and scripting:
python file_organizer.pyWhen prompted, enter the directory path you want to organize:
-----Basic File Organizer-----
Enter the source directory path: /Users/username/Downloads
Example with direct path:
python file_organizer.py /path/to/your/folderIdeal for visual file management:
python file_organizer_gui.pySteps:
- Click Browse to select a folder
- Click Scan Files to preview what will be organized
- Review the file list and categories
- Click Organize Files to move files into categorized folders
- View progress bar and results summary
| Category | File Extensions |
|---|---|
| Documents | .pdf, .doc, .docx, .txt, .xls, .xlsx, .ppt, .pptx, .odt, .rtf |
| Images | .jpg, .jpeg, .png, .gif, .bmp, .tiff, .svg, .webp |
| Videos | .mp4, .avi, .mov, .wmv, .flv, .mkv, .webm |
| Music | .mp3, .wav, .aac, .flac, .ogg, .wma |
| Code | .py, .js, .html, .css, .java, .cpp, .c |
| Archives | .zip, .tar.gz, .rar, .7z |
| Executables | .exe, .msi, .dmg, .deb |
- MISC: Files without extensions
- Extension Folders: Unknown file types get their own folder (e.g.,
.csvfiles go tocsv/folder)
Before Organization:
Downloads/
├── vacation_photo.jpg
├── report.pdf
├── song.mp3
├── movie.mp4
├── script.py
└── data.csv
After Organization:
Downloads/
├── Documents/
│ └── report.pdf
├── Images/
│ └── vacation_photo.jpg
├── Music/
│ └── song.mp3
├── Videos/
│ └── movie.mp4
├── py/
│ └── script.py
├── csv/
│ └── data.csv
└── file_organizer.log
When duplicate filenames are encountered:
- Original:
report.pdf→ Stays asreport.pdf - Duplicate:
report.pdf→ Renamed toreport_1.pdf
- Hidden files: Files starting with
.are skipped - Subdirectories: Existing folder structure is preserved
- File integrity: No file content is modified
- No overwrites: Files are safely renamed if conflicts occur
All operations are logged in file_organizer.log:
2025-08-31 10:30:15,123 - INFO - Started file organization process
2025-08-31 10:30:15,124 - INFO - Source directory: /Users/username/Downloads
2025-08-31 10:30:15,126 - INFO - Found file: vacation_photo.jpg, extension: .jpg, category: Images
2025-08-31 10:30:15,127 - INFO - Moved file: vacation_photo.jpg to /Users/username/Downloads/Images
"Directory does not exist"
- Check path for typos
- Use absolute paths for reliability
"Not a directory"
- Ensure you're pointing to a folder, not a file
Permission errors
- Verify read/write permissions
- Run with appropriate privileges if needed
- Backup Important Data: Always backup critical files before organizing
- Test First: Try the organizer on a small test directory
- Review Logs: Check the log file after operations
- Regular Use: Run periodically to maintain organized directories
- Custom Categories: Modify
FILE_CATEGORIESin the script for custom file types
- Batch Processing: Run on multiple directories sequentially
- Automation: Set up scheduled tasks for automatic organization
- Customization: Edit file categories and extensions in the source code
- Integration: Incorporate into larger file management workflows
file_organizer.py # Command-line version
file_organizer_gui.py # GUI version with tkinter interface
README.md # This comprehensive guide
If you encounter issues:
- Check the log file for detailed error messages
- Verify directory permissions and paths
- Review this guide for common solutions
- Ensure Python and tkinter are properly installed
Transform your cluttered directories into organized, categorized file systems with just a few clicks! 🎯