A Python script to automatically organize files on your desktop by moving them into categorized folders.
- Automatically sorts files into predefined categories (Images, Documents, Videos, etc.)
- Handles locked files gracefully (skips them with a warning)
- Progress bar visualization using
tqdm - Cross-platform compatibility (Windows/macOS/Linux)
- Creates necessary folders if they don't exist
- "Others" category for unrecognized file types
| Category | File Extensions |
|---|---|
| Images | .jpg, .jpeg, .png, .gif, .bmp, .svg, .webp |
| Documents | .pdf, .docx, .doc, .xlsx, .pptx, .txt, .csv |
| Videos | .mp4, .mov, .avi, .mkv, .flv, .wmv |
| Audio | .mp3, .wav, .ogg, .m4a, .flac |
| Archives | .zip, .rar, .7z, .tar, .gz |
| Executables | .exe, .msi, .dmg, .pkg, .sh |
| Code | .py, .js, .html, .css, .cpp, .java, .json, .cs, .pkt |
| Sprites | .ase, .pxo, .aseprite, .kra |
| Shortcuts | .lnk |
| Others | (Any unrecognized file types) |
- Python 3.x
- Required packages:
tqdm
Install dependencies with:
pip install tqdmSave the script as organize_desktop.py
Run the script:
python organize_desktop.pyThe script will:
-
Scan your desktop for files
-
Create category folders if they don't exist
-
Move files to their appropriate folders
-
Display a progress bar during the process
-
Skip any locked files (files currently in use)
This script can be used to automatically sort out your desktop depending on your categories.
No Bash Script is needed.
-
Open Task Scheduler
- Press Win + R, type taskschd.msc, and hit Enter.
-
Create a New Task
-
General Tab:
-
Name: Desktop Cleaner
-
Check: "Run whether user is logged on or not"
-
-
Set Trigger (e.g., Daily at 3 AM)
- Triggers Tab → New → Select Daily → Set time.
-
Set Action
-
Actions Tab → New → Configure:
-
Program/script: C:\Python39\python.exe (your Python path)
-
Add arguments: "C:\path\to\organize_desktop.py" (script path)
-
Start in: "C:\path\to\script\folder"
-
-
Click OK → Test by right-clicking the task → Run.
-
The script only organizes files, not folders
-
Hidden files (starting with '.') are ignored
-
If the script fails to move a file, it displays an error message and continues
-
You can customize the categories by editing the file_categories dictionary in the script
To add or modify file categories, edit the file_categories dictionary in the script. The format is:
file_categories = {
"CategoryName": [".ext1", ".ext2", ...],
...
}Free to use and modify. No warranties provided.