Hi,
On my Win98 machine I always ran this batch script to delete a bunch of temporary files in the directory from where the bacth was run and its sub-directories.
It doesn't seem to work using NT (2K, XP)
Question, can somebody suggest a solution ?
Preferably a solution that works well on Win98 ranging to WinXP but if that is not possible then no problem.
I have to ditch 98 sooner or later anyway.
This is the batch I have been using all these years :
echo off
rem del __del.lst
rem del __dell.lst
rem del __dell.bat
del deleted.lst
dir *.~?? /s/b >> __dell.lst
dir *.~? /s/b >> __dell.lst
dir *.il? /s/b >> __dell.lst
dir *.obj /s/b >> __dell.lst
copy __dell.lst deleted.lst
::
http://www.ericphelps.com/batch/samples/vxe2exe.bat.txt
::
:: Make a line fragment
:: See
http://www.ericphelps.com/batch/lines/frag-dbg.htm
echo e 100 "del " > script
echo e 104 22 >> script
echo rcx>> script
echo 5>> script
echo n __del.lst>> script
echo w>> script
echo q>>script
debug < script > nul
del script
:: Now process each line
:LOOPSTART
rem *** Check to see if __dell.lst is zero bytes
dir __dell.lst | find "__dell.lst" | find " 0 " > nul
if not errorlevel 1 goto DONE
copy /b __del.lst + __dell.lst __dell.bat > nul
rem *** Create a new __dell.lst minus the first line
type __dell.bat | find /v "del " > __dell.lst
rem *** Trim the bat file so it only has the first line
type __dell.bat | find "del " > __dell.bat
rem *** Display :
type __dell.bat
rem *** Execute :
call __dell.bat
goto LOOPSTART
:DONE
del __del.lst
del __dell.lst
del __dell.bat
1) for /R c:\ does scan the C: drive starting at the root.
2) Win98 does not understand the /R option for the for statement.
Here is this complete batch file:
@echo off
if "%OS%"=="" goto DO98CODE
for /R . %%a in (*.~??, *.~?, *.il?, *.obj) do echo del "%%a"
goto :EOF
:DO98CODE
rem del __del.lst
rem del __dell.lst
rem del __dell.bat
del deleted.lst
dir *.~?? /s/b >> __dell.lst
dir *.~? /s/b >> __dell.lst
dir *.il? /s/b >> __dell.lst
dir *.obj /s/b >> __dell.lst
copy __dell.lst deleted.lst
:: http://www.ericphelps.com/batch/samples/vxe2exe.bat.txt
::
:: Make a line fragment
:: See http://www.ericphelps.com/batch/lines/frag-dbg.htm
echo e 100 "del " > script
echo e 104 22 >> script
echo rcx>> script
echo 5>> script
echo n __del.lst>> script
echo w>> script
echo q>>script
debug < script > nul
del script
:: Now process each line
:LOOPSTART
rem *** Check to see if __dell.lst is zero bytes
dir __dell.lst | find "__dell.lst" | find " 0 " > nul
if not errorlevel 1 goto DONE
copy /b __del.lst + __dell.lst __dell.bat > nul
rem *** Create a new __dell.lst minus the first line
type __dell.bat | find /v "del " > __dell.lst
rem *** Trim the bat file so it only has the first line
type __dell.bat | find "del " > __dell.bat
rem *** Display :
type __dell.bat
rem *** Execute :
call __dell.bat
goto LOOPSTART
:DONE
del __del.lst
del __dell.lst
del __dell.bat