@echo off
setlocal enabledelayedexpansion

REM Path to your CSV file
set "csvfile=C:\Users\g.bador\Documents\RenameFiguresWithObjects\FirguresWithObjects2.csv"

REM Loop through each line in the CSV file
for /f "tokens=1,2 delims=;" %%A in ('type "%csvfile%"') do (
    set "oldname=%%A"
    set "newname=%%B"
    REM Remove quotes if present
    set "oldname=!oldname:"=!
    set "newname=!newname:"=!
    REM Rename the file
    ren "!oldname!" "!newname!"
)

echo Files renamed successfully.
pause
