I have one requirement to modify name for list of directories through
command prompt. Operating system is Windows Server 2008 R2.
Example - I do have following directory structure
Example - I do have following directory structure
- ROOT
- 123#5
- 11
- 22
- 123#6
- 11
- 22
- 33
- 123#7
- 123#8
- 44
- 123#5
- ROOT
- 123~5
- 11
- 22
- 123~6
- 11
- 22
- 33
- 123~7
- 123~8
- 44
Batch File
@echo off setlocal EnableDelayedExpansion for /r "C:\root" %%d in (.) do ( set dirname=%%~nxd echo !dirname! | findstr "#" >nul if !errorlevel! equ 0 ( set newname=!dirname:#=~! ren "%%~dpnd" "!newname!" ) ) endlocal
- 123~5
No comments:
Post a Comment