Skip to content

Instantly share code, notes, and snippets.

@xn4k
Last active November 16, 2025 04:17
Show Gist options
  • Select an option

  • Save xn4k/ed47e27adc2bf12a0b79afe991317f1f to your computer and use it in GitHub Desktop.

Select an option

Save xn4k/ed47e27adc2bf12a0b79afe991317f1f to your computer and use it in GitHub Desktop.
@echo off
setlocal enabledelayedexpansion
for /d %%F in ("*xxxxx*") do (
set "old=%%F"
set "new=!old:xxxxx=yyyy!"
echo REN "%%F" "!new!"
ren "%%F" "!new!"
)
endlocal
# Bulk Folder Rename Script (Windows Batch)
Simple batch script to rename all folders matching a pattern.
Uses delayed variable expansion for inline string replacement.
Everywhere where you see an xxxxx put an old part of the folder name, this script will rename all the folders in yyyy or refactor this part of the file name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment