@echo off
setlocal EnableDelayedExpansion
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo This script must be run as administrator.
    pause
    exit /b
)
set "folders[0]=C:\ProgramData\Autodesk\RVT 2017\IES"
set "folders[1]=C:\ProgramData\Autodesk\RVT 2018\IES"
set "folders[2]=C:\ProgramData\Autodesk\RVT 2019\IES"
set "folders[3]=C:\ProgramData\Autodesk\RVT 2020\IES"
set "folders[4]=C:\ProgramData\Autodesk\RVT 2021\IES"
set "folders[5]=C:\ProgramData\Autodesk\RVT 2022\IES"
set "folders[6]=C:\ProgramData\Autodesk\RVT 2023\IES"
set "folders[7]=C:\ProgramData\Autodesk\RVT 2024\IES"
set "folders[8]=C:\ProgramData\Autodesk\RVT 2025\IES"
set "folders[9]=C:\ProgramData\Autodesk\RVT 2026\IES"
set "folders[10]=C:\ProgramData\Autodesk\RVT 2027\IES"
set "script_dir=%~dp0"
for /L %%i in (0,1,10) do (
    set "folder=!folders[%%i]!"
    
    if exist "!folder!" (
        echo Folder "!folder!" exists.            
        if not exist "!folder!\PROMLED" (
            echo Subfolder PROMLED does not exist. Creating...
            mkdir "!folder!\PROMLED"
        ) else (
            echo Subfolder PROMLED already exists.
        )              
        echo Copying .ies files to "!folder!\PROMLED"
        copy "%script_dir%\ies\*.ies" "!folder!\PROMLED" /Y
    ) else (
        echo Folder "!folder!" does not exist. Skipping.
    )
)

echo Operation completed.
pause
