Python script for automatically organizing and sorting files in the current directory
Find a file
BlackusPL 3340e38b40
All checks were successful
Build app / build (push) Successful in 1m34s
Sort files / build (push) Successful in 19s
feat: add Forgejo CI/CD workflows and expand file extension support for sorting
2026-07-23 14:48:23 +02:00
.forgejo/workflows feat: add Forgejo CI/CD workflows and expand file extension support for sorting 2026-07-23 14:48:23 +02:00
main.py feat: add Forgejo CI/CD workflows and expand file extension support for sorting 2026-07-23 14:48:23 +02:00
README.md feat: add Forgejo CI/CD workflows and expand file extension support for sorting 2026-07-23 14:48:23 +02:00

Sort Your Files

A script in Python for automatically organizing and sorting files in the current directory based on their extensions and execution permissions.

Features

  • Automatic file categorization: Moves files from the current directory to appropriately named subdirectories.
  • Supported categories:
    • Images: .jpg, .jpeg, .png, .gif, .bmp, .tiff, .svg, .webp, .avif, .psd, .ico, .jfif
    • Docs: .pdf, .docx, .txt, .xlsx, .pptx, .csv, .doc, .djvu, .rtf, .crx, .odt
    • Audio: .mp3, .wav, .aac, .flac, .ogg, .m4a, .opus, .weba
    • Videos: .mp4, .avi, .mov, .mkv, .m4v, .mpg4, .webm, .mpeg
    • Archives: .zip, .rar, .tar, .gz, .7z, .iso, .zst, .tgz, .bz2, .lz, .liz, .lz4, .lz5, .wim, .xz
    • MCPACKS: .mcpack, .mcworld
    • Others: .json, .js, .torrent, .mhtml, .html, .mht, .xml, .apk, .apkm, .ps1, .rbxl, .rbxm, .lua, .ini, .rdp, .jar
    • Programs: .exe, .msi, .cmd, .bat, .sh, .AppImage and files with execution permissions in Unix/Linux systems.
  • Automatic folder creation: Target folders are created dynamically as needed.
  • Configure folder structure: You can configure the folder structure by editing main.py file.

Requirements

  • Python 3.9 or higher

Usage

Run the script in the directory to be sorted:

python main.py

Folder structure

The script creates only the following subdirectories when it finds any file with the specified extension.

Images/
Docs/
Audio/
Videos/
Archives/
MCPACKS/
Others/
Programs/