|Okay, I was able to get it working except for one problem, If |
there is an exclamation point (!) in the subdirectory or file
name, it will not work. This is my current code:
for /d %%x in (*.*) do (
call :Rename %%x
echo Initial count: %count%
for %%f in ("%DirName%\*") do (
if !count! equ 1 ren "%%f" "%DirName%%%~xf"
if !count! gtr 1 ren "%%f" "%DirName% (!count!)%%~xf"
set /a count+=1
echo Incremented count: %count%