Skip to content

Instantly share code, notes, and snippets.

@GalaxySH
Created March 4, 2026 07:04
Show Gist options
  • Select an option

  • Save GalaxySH/dedd4cec221d18c9cbeb370024df0dd7 to your computer and use it in GitHub Desktop.

Select an option

Save GalaxySH/dedd4cec221d18c9cbeb370024df0dd7 to your computer and use it in GitHub Desktop.
Organize (downloaded) files into folders designated by their extension (2018-04-27)
@echo off
rem For each file in your folder
for %%a in (".\*") do (
rem check if the file has an extension and if it is not our script
if "%%~xa" NEQ "" if "%%~dpxa" NEQ "%~dpx0" (
rem check if extension folder exists, if not it is created
if not exist "%%~xa" mkdir "%%~xa"
rem Move the file to directory
move "%%a" "%%~dpa%%~xa\"
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment