Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

organize.bat

A simple Windows batch script that auto-sorts files in a folder into categorized subfolders.


Features

  • Extension-based sorting — each file is routed to a folder based on its extension
  • Auto-creates category foldersImages, Documents, PDFs, Videos, Music, Archives, Installers, Scripts, Others are created automatically if they don't exist
  • Skips itself — the script won't move itself into Scripts while running
  • Silent move — files are moved without confirmation prompts; any errors are suppressed
  • Pause on completion — the window stays open so you can see the "Done. Files sorted." message

Usage

  1. Download or clone this repository.
  2. Place organize.bat inside the folder you want to sort.
  3. Double-click organize.bat, or run it from the command prompt:
organize.bat
  1. Done. Your files are now sorted into subfolders.

Note: The script only sorts files in the same folder where it is placed. It does not recurse into subfolders.


Supported Extensions

Category Extensions
Images .jpg .jpeg .png .gif .bmp .svg .webp
Documents .doc .docx .txt .xls .xlsx .ppt .pptx .csv
PDFs .pdf
Videos .mp4 .mkv .avi .mov .wmv
Music .mp3 .wav .flac .aac
Archives .zip .rar .7z .tar .gz
Installers .exe .msi
Scripts .bat .ps1 .py .js .sh
Others (anything not listed above)

Requirements

  • Windows only — requires cmd.exe
  • No additional software, runtimes, or dependencies needed

How to Add More Extensions

Open organize.bat in any text editor and find the :sort label (around line 28). Add a new line in the appropriate block using this pattern:

if /i "%e%"==".ext" set "dest=Category"

Example — to send .ogg files to the Music folder:

if /i "%e%"==".ogg" set "dest=Music"

To create a brand new category (e.g. Fonts):

  1. Add the folder name to the for %%D in (...) loop at the top of the script so it gets created automatically.
  2. Add your if /i lines in the :sort section pointing dest to that new folder name.

Warning

  • This script moves files — it does not copy them. Once a file is moved, it is no longer in the original location. Back up your folder before running this script for the first time.
  • Only top-level files in the same folder as the script are sorted. Files inside existing subfolders are left untouched.

License

MIT — see LICENSE for details.

About

FileSorter — simple, obvious, taken a million times but says exactly what it does.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages