Skip to content

Latest commit

 

History

History
129 lines (79 loc) · 3.43 KB

File metadata and controls

129 lines (79 loc) · 3.43 KB

Desktop Organizer Script

Python License Maintenance OS Code Style

A Python script to automatically organize files on your desktop by moving them into categorized folders.

Features

  • 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

Supported File Categories

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)

Prerequisites

  • Python 3.x
  • Required packages: tqdm

Install dependencies with:

pip install tqdm

Usage

Save the script as organize_desktop.py

Run the script:

python organize_desktop.py

The 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)

⏰ Schedule Automatic Runs (Windows Task Scheduler)

This script can be used to automatically sort out your desktop depending on your categories.

No Bash Script is needed.

Instructions

  • 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.

Notes

  • 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

Customization

To add or modify file categories, edit the file_categories dictionary in the script. The format is:

file_categories = {
    "CategoryName": [".ext1", ".ext2", ...],
    ...
}

License

Free to use and modify. No warranties provided.