Skip to content

How Sortify Works

A_Reza edited this page Nov 18, 2025 · 1 revision

How Sortify Works

When you run Sortify, it scans the specified directory and moves files into sub-folders based on their extension.

📂 Category Mapping

Below is the default configuration for file sorting.

Category Folder Name Extensions
Images /Images .jpg, .jpeg, .png, .gif, .bmp, .svg, .tiff, .webp
Videos /Videos .mp4, .mkv, .mov, .avi, .flv, .wmv
Documents /Documents .pdf, .doc, .docx, .txt, .ppt, .pptx, .xls, .xlsx, .csv
Music /Music .mp3, .wav, .aac, .flac
Archives /Archives .zip, .rar, .7z, .tar, .gz
Programs /Programs .exe, .msi, .dmg, .apk, .deb, .rpm, .appimage
Code /Code .py, .js, .html, .css, .java, .cpp, .php, .c, .ts, .go, .rs

Any file not matching these extensions is placed in an "Others" folder.

🛡️ Safety Mechanisms

Sortify includes a Collision Prevention system.

Scenario: You have document.pdf in your source folder, but the Documents folder already contains a file named document.pdf.

Result: Sortify will NOT overwrite the existing file. Instead, it will rename the new file to document_1.pdf (or document_2.pdf etc.) and then move it safely.

🚫 Ignored Files

To protect your system and the script itself, Sortify ignores:

  1. main.py (The script itself)
  2. .DS_Store (macOS system files)
  3. Folders (It only moves files, it does not move folders inside folders).

Clone this wiki locally