@echo off
setlocal enabledelayedexpansion

REM Path to your folder containing images (current directory)
set "folder_path=%~dp0"

echo Folder path: %folder_path%

REM Counter for renaming
set "counter=1"

REM Loop through each file in the folder
for %%F in ("%folder_path%\*") do (
    echo Processing file: %%F
    REM Check if the file exists and is not a directory
    if exist "%%F" if not exist "%%F\" (
        REM Extract the numeric part from the filename
        for /f "tokens=3 delims=-." %%A in ("%%~nF") do (
            REM Rename the file to saree[counter].[extension]
            for %%X in ("%%~xF") do (
                ren "%%F" "saree!counter!%%X"
                echo Renamed "%%~nxF" to saree!counter!%%X
            )
        )
        REM Increment the counter
        set /a "counter+=1"
    ) else (
        echo %%F is not a regular file.
    )
)

pause
