An automated file organization tool that monitors your Downloads, Pictures, and Desktop folders and automatically sorts files into categorized directories based on their file extensions.
- Overview
- Features
- How It Works
- Installation
- Usage
- File Organization Structure
- Supported File Types
- Configuration
- Troubleshooting
- Contributing
Desktop Cleaner is a Python-based file management utility that automatically organizes your files by monitoring specified directories and moving files to categorized folders based on their extensions. It runs continuously in the background and organizes files as soon as they appear in the watched directories.
- Real-time Monitoring: Uses watchdog to monitor file system events
- Automatic Organization: Sorts files by type into predefined categories
- Date-based Structure: Creates year/month subdirectories for better organization
- Duplicate Handling: Automatically renames files to prevent overwrites
- Multi-directory Support: Monitors Downloads, Pictures, and Desktop simultaneously
- Extensive File Type Support: Handles 80+ file extensions across multiple categories
- Background Operation: Runs silently in the background with minimal resource usage
- File Detection: The tool monitors your Downloads, Pictures, and Desktop folders for new files
- Extension Recognition: When a file is detected, it identifies the file type by its extension
- Category Assignment: Files are categorized into groups like media, documents, programming files, etc.
- Date Organization: Files are placed in year/month subdirectories (e.g.,
2024/JAN/) - Conflict Resolution: If a file with the same name exists, it adds a number suffix to make it unique
- File Movement: The file is moved to its designated organized location
- Python 3.6 or higher
- pip (Python package installer)
pip install watchdoggit clone https://github.com/yourusername/desktop-cleaner.git
cd desktop-cleaner-
Navigate to the project directory:
cd desktop_cleaner -
Run the cleaner:
python cleandesk.py
-
The tool will start monitoring your directories. You'll see it running until you stop it with
Ctrl+C.
On Linux/macOS:
nohup python cleandesk.py &On Windows: You can create a batch file or use Task Scheduler to run it automatically on startup.
Files are organized in the following structure:
~/Downloads/holder of things/
βββ 2024/
β βββ JAN/
β β βββ media/
β β β βββ images/
β β β βββ audio/
β β β βββ video/
β β βββ text/
β β β βββ pdf/
β β β βββ microsoft/
β β β βββ presentations/
β β βββ programming/
β β β βββ python/
β β β βββ java/
β β β βββ database/
β β βββ other/
β β βββ compressed/
β β βββ executables/
β β βββ internet/
β βββ FEB/
β βββ [same structure]
βββ 2025/
βββ [same structure]
- Images:
.jpg,.jpeg,.png,.gif,.bmp,.svg,.tiff,.psd,.ai,.cr2 - Audio:
.mp3,.wav,.ogg,.wma,.m3u,.midi,.aif - Video:
.mp4,.avi,.mkv,.mov,.wmv,.flv,.3gp
- Text:
.txt,.rtf,.tex,.odt - PDF:
.pdf - Microsoft Office:
.doc,.docx,.xls,.xlsx,.ppt,.pptx - Presentations:
.key,.odp,.pps
- Python:
.py - Java:
.java,.class - C/C++:
.c,.h - Web:
.html,.css,.js,.php,.asp - Database:
.csv,.sql,.json,.xml,.db - Shell:
.sh
- Compressed:
.zip,.rar,.7z,.tar.gz - Executables:
.exe,.apk,.jar,.bat - Fonts:
.ttf,.otf,.fnt - System:
.dll,.sys,.ini,.ico
Edit the cleandesk.py file to modify watched directories:
# Current default paths
watch_path_1 = Path.home() / 'Downloads'
watch_path_2 = Path.home() / 'Pictures'
watch_path_3 = Path.home() / 'Desktop'
# Destination directories
destination_root_1 = Path.home() / 'Downloads/holder of things'
destination_root_2 = Path.home() / 'Pictures/holder of things'
destination_root_3 = Path.home() / 'Desktop/holder of things'Edit extensions.py to add new file extensions:
extension_paths = {
'.your_extension': 'category/subcategory',
# Add your custom extensions here
}Modify the destination paths in cleandesk.py to use different folder names:
destination_root_1 = Path.home() / 'Downloads/Organized Files'-
Permission Errors
- Ensure Python has permission to read/write in the target directories
- On macOS, you might need to grant Terminal full disk access
-
Files Not Moving
- Check if the file extension is listed in
extensions.py - Verify the destination directory exists and is writable
- Check if the file extension is listed in
-
Script Stops Unexpectedly
- Check for file system errors or insufficient disk space
- Review the console output for error messages
Add print statements to EventHandler.py for debugging:
def on_modified(self, event):
print(f"Event detected: {event}")
# ... rest of the codeContributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Add new file types to
extensions.py - Improve the organization logic in
EventHandler.py - Add error handling and logging
- Write tests for new functionality
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Add a GUI interface
- Implement configuration file support
- Add logging functionality
- Create platform-specific installers
- Add support for cloud storage synchronization
- Implement undo functionality
- Add file preview before moving
- GUI interface with system tray integration
- Configuration file support (YAML/JSON)
- Logging and activity history
- Undo functionality
- Cloud storage integration
- Machine learning-based file categorization
- Email notifications for organized files
- Scheduled cleanup routines
- Backup your files before running the tool for the first time
- The tool moves files (not copies), so they will be relocated from their original position
- Large files might take a moment to process
- The tool runs continuously until manually stopped
- Operating System: Windows, macOS, or Linux
- Python: 3.6 or higher
- RAM: Minimal (< 50MB)
- Storage: Depends on files being organized
- Permissions: Read/write access to monitored directories