1
2
3
4
5
6
7
8
9
10
11
12
13
:: Usage: renamer.cmd bigdirectorywithfiles

@echo off & setlocal
if "%~1"=="" (
	set dir=.
) else (
	set dir=%1
)
set suffix=_%RANDOM%_
for /r %dir% %%f in (*) do (
	echo Fixing %%~f
	ren "%%~f" "%%~nxf.%suffix%" && ren "%%~f.%suffix%" "%%~nxf"
)