@echo off
setlocal enabledelayedexpansion

:: Daftar kategori dan jumlah file
call :process_folder "alat_tulis_kantor" 6
call :process_folder "alat_rumah_tangga" 14
call :process_folder "tas" 4
call :process_folder "helm" 2

echo Rename selesai.
pause
exit /b

:process_folder
set "folder=%~1"
set "max_count=%~2"
set /a count=0

:: Buat folder jika belum ada
if not exist "%folder%" mkdir "%folder%"

pushd "%folder%"
for %%f in (*.jpg) do (
    set /a count+=1
    set "num=00!count!"
    set "num=!num:~-3!"
    ren "%%f" "img!num!.jpg"
    if !count! geq %max_count% goto :done
)
:done
popd
exit /b
