cmd rename multiple folders code example

Example: cmd rename multiple folders

# EXAMPLE: adds "_zzz" to every folder found within the "G:\Deletable\" folder
for /d %F in ("G:\Deletable\*") do rename "%F" "%~nF_zzz"

# SYNTAX
# for <your-options> %F in ("<root-directory>\*") do rename "%F" "%~nF<your-text-to-add>"

# NOTE: if you would like to replace an internal substring with text in a directory, use the following
# example: this replaces all the ")" characters with "_"
@echo off
setlocal EnableDelayedExpansion
set "pattern_to_replace=("
set "replace_text=_"

for %%N in ("*") do (

	set "InitName=%%N"
	call set NewName=%%InitName:!pattern_to_replace!=!replace_text!%%
	rename "!InitName!" "!NewName!"
)

@echo on