| 1. |
Solve : Batch or script to rename directories - Please help? |
|
Answer» Hi, directories are like this What is the PATH to the directories you want to rename?this is not important I can map it as I want for example D:\1.2.09\ Try this - not fully tested. Code: [Select]@echo off setlocal enabledelayedexpansion cls :: Syntax: Enter batch script filename followed by the year :: e.g. script 09 :: script 10 for /F "tokens=1-3 delims=." %%1 in ('dir /ad /b d:\*.%1') do ( set mm=%%1 set dd=%%2 set yy=%%3 set infil=d:\!mm!.!dd!.!yy! if !mm! lss 10 set mm=0!mm! if !dd! lss 10 set dd=0!dd! echo.&echo !infil! will be renamed to !yy!.!mm!.!dd! rem ren !infil! !yy!.!mm!.!dd! ) Thank you it works very well. |
|