Last active
December 31, 2015 22:09
-
-
Save amolok/8051722 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
IF [%1]==[] ( | |
echo renumbers.cmd filemask filename digits start digits start cycle | |
echo ~~~~~~~~~~~~~ bon_*.bmp bon 2 1 1 1 4 | |
echo bon011.bmp bon012.bmp bon013.bmp bon014.bmp bon021.bmp bon022.bmp ... | |
echo ------------------------------------------------------------------------------------ | |
) ELSE ( | |
setlocal EnableDelayedExpansion | |
set prefix = %2 | |
set /a digits = %3 | |
set /a pstart = %4 | |
set /a second = %5 | |
set /a sstart = %6 | |
set /a cycle = %7 | |
for %%a in (%1) do ( set /a i+=1 ) | |
echo %1: !i! | |
set /a j = sstart | |
set /a i = pstart | |
for %%a in (%1) do ( | |
set pre=00000000!j! | |
call set pre=%%pre:~-%digits%,%digits%%% | |
set suf=00000000!i! | |
call set suf=%%suf:~-%second%,%second%%% | |
set newname=%2!pre!!suf! | |
set /a i+=1 | |
if !i! GTR !cycle! ( | |
set /a i=sstart | |
set /a j+=1 | |
) | |
echo %%a = !newname! | |
ren %%a !newname!.* | |
) | |
echo ------------------------------------------------------------------------------------ | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment