I want to be able to rerun my code multiple times and I think my problems come from the variables. I can't figure where I have to put the setlocal and the endlocal. As you can see I put setlocal just before the variable but it's still not working.
setlocal
set "reply=g"
set /p "reply=Voulez vous garder ou supprimer un certain type de fichier ? [g|s]: "
if /i "%reply%" == "g" (
setlocal
set /p ext="Quelles extentions voulez vous garder (Ecrivez avec le point toutes les extentions) ? : "
for /f "delims=" %%F in ('dir /b /s /a-d "%_FolderName%"^| findstr /vile "%ext%"') do del "%%F"
endlocal )
if /i "%reply%" == "s" (
setlocal
set /p ext="Quelles extentions voulez vous supprimer (Ecrivez avec le point toutes les extentions) ? : "
for /f "delims=" %%F in ('dir /b /s /a-d "%_FolderName%"^| findstr "%ext%"') do del "%%F"
endlocal )
endlocal