@ECHO OFF
CLS
SET found=0
SET found1=0
REM ECHO Enter the file extension you want to delete...
REM SET /p ext="\> "
SET ext=txt
SET ext1=xlsx
IF EXIST \*.%ext% ( rem Check if there are any in the current folder :)
DEL \*.%ext%
SET found=1
)
FOR /D /R %%G IN ("\*") DO ( rem Iterate through all subfolders
IF EXIST %%G CD %%G
IF EXIST \*.%ext% (
DEL \*.%ext%
SET found=1
)
)
IF %found%==1 (
ECHO.
ECHO Deleted all .%ext% files.
ECHO.
) ELSE (
ECHO.
ECHO There were no .%ext% files.
ECHO Nothing has been deleted.
ECHO.
)
%------THIS PART NOT FUNCTIONING------%
IF EXIST \*.%ext1% ( rem Check if there are any in the current folder :)
DEL \*.%ext1%
SET found1=1
)
FOR /D /R %%G IN ("\*") DO ( rem Iterate through all subfolders
IF EXIST %%G CD %%G
IF EXIST \*.%ext1% (
DEL \*.%ext1%
SET found1=1
)
)
IF %found1%==1 (
ECHO.
ECHO Deleted all .%ext1% files.
ECHO.
) ELSE (
ECHO.
ECHO There were no .%ext1% files.
ECHO Nothing has been deleted.
ECHO.
)
%-------------------------------------%
PAUSE
EXIT
Hi to all expert. How to allow the 2nd part not functioning to become functional?