I have 100 consecutive PNG files, used in one boot animation. But with different steps between them
Example: 1, 4, 5, 10, 14, 15, 16, 19...
Using Ant Renamer is enough, and it's a good application for this, but i love to do it with the old black screen with a batch file.
Can anyone give me an idea, how to rename them from 1 to 100 preserving the order of sequences?
To be saved as batch file and called with the folder path as argument. By default, the current folder is processed
@echo off
setlocal enableextensions disabledelayedexpansion
rem - Set folder to be processed
set "folder=%~1"
if not defined folder set "folder=%cd%"
rem - Prepare work environment
pushd "%folder%" & setlocal enabledelayedexpansion
rem - Load file list into array with number padding
for /f %%a in ('dir /b /a-d "*.png"^|findstr /i /r /x /c:"[0-9]*\.png"') do (
set /a "n=100000000+%%~na"
set "n[!n!]=%%a"
)
rem - Retrieve the list from memory and, for each element in the
rem array, rename the file to the correct name
set "n=1"
for /f "tokens=2 delims==" %%a in ('set n[') do (
set "name=000!n!"
echo ren "%%a" "!name:~-3!.png"
set /a "n+=1"
)
rem - Cleanup
endlocal & popd
endlocal