I'm afraid the above won't work because unfortunately, neither the DEL or ERASE commands use a "/S" (subdirectory) parameter. (Type "DEL /?" [not the quotes] for DEL syntax).
You might try something like this:Code:@echo off :CLEANUP.BAT v1.00 - Type "CLEANUP /?" (no quotes) for brief help :Begin if (%1)==(?) goto Syntax if (%1)==(/?) goto Syntax goto Search :Syntax echo. echo Name: CLEANUP.BAT v1.00 echo. echo Purpose: After prompting user for Yes/No answer, deletes all "*.bak", echo "*.old", "*.gid", "*.tmp" and "*.$$$" files found on drive C:. echo. echo Syntax: cleanup [/?] echo. echo Where: Optional "/?" will display this help screen echo. echo Requires: MORE.COM, CHOICE.COM and QBASIC.EXE somewhere in the PATH echo. goto End :Search cls echo CLEANUP.BAT v1.00 echo. echo Searching drive C: for all "*.bak" files ... echo. dir/a-d/s/b c:\*.bak>cleanup$.lst echo Searching drive C: for all "*.old" files ... echo. dir/a-d/s/b c:\*.old>>cleanup$.lst echo Searching drive C: for all "*.gid" files ... echo. dir/a-d/s/b c:\*.gid>>cleanup$.lst echo Searching drive C: for all "*.tmp" files ... echo. dir/a-d/s/b c:\*.tmp>>cleanup$.lst echo Searching drive C: for all "*.$$$" files ... echo. dir/a-d/s/b c:\*.$$$>>cleanup$.lst copy cleanup$.lst+,,>nul if exist cleanup$.lst goto View :Nothing to do echo No files of type: echo. for %%x in (bak old gid tmp $$$) do echo *.%%x echo. echo were found. goto Done :View cls more cleanup$.lst echo. choice/c:ynv/n "Delete these files? (Y/N), (or [V]iew list again) (Y/N/V): " if errorlevel 3 goto View if errorlevel 2 goto Done :Delete echo OPEN "cleanup$.lst" FOR INPUT AS #1>cleanup$.bas echo OPEN "cleanup$.bat" FOR OUTPUT AS #2>>cleanup$.bas echo PRINT #2, "@echo on">>cleanup$.bas echo DO WHILE NOT EOF(1)>>cleanup$.bas echo LINE INPUT #1, Rec$>>cleanup$.bas echo PRINT #2, "del " + CHR$(34) + Rec$ + CHR$(34)>>cleanup$.bas echo LOOP>>cleanup$.bas echo CLOSE : SYSTEM>>cleanup$.bas qbasic /run cleanup$.bas cls call cleanup$.bat :Done for %%x in (lst bas bat) do if exist cleanup$.%%x del cleanup$.%%x echo. echo Processing complete. Exiting to DOS. echo. :End




Reply With Quote