Fred's Deep Blush (Deleting TMP Files) Pt3
(Continued from above item; use all the following as EXAMPLES that may have to be tweaked to work properly on your specific system.)
And this reader's solution is worth isolating because of the comments regards the use of XP's "CMD:"
Fred:
Deltmpdir.cmd
----------//----------
@echo off
Pushd c:\
for /F "usebackq delims=" %%a in (`dir *.tmp /ad/s/b`) do rd "%%a" /s/q
Popd
----------//----------
To clean up real temp dirs, something like this works swimmingly:
DelTempFiles.cmd
----------//----------
@echo off
Pushd c:\
for /F "usebackq delims=" %%a in (`dir *Temp /ad/s/b`) do (
pushd "%%a"
echo "%%a"
rd . /s/q
popd
)
popd
----------//----------
Very succinct and imminently maintainable.
Any commands that you do not know what they do, you can use the built-in
HELP command from a CMD prompt for detailed information: (ie, HELP PUSHD,
HELP POPD, HELP FOR, HELP ECHO, HELP IF)
Note that for the past 6 years or more the CMD processor has supported
such features, including scoping and statement blocks. Unfortunately most
people think that batch files should have an extension of .BAT. Until
recently this meant they were processed using the COMMAND processor rather
than the CMD processor and thus were confined to the 1970's batch language
implemented in DOS's Command processor even though far more advanced
capabilities were available simply by writing NT CMD batch files rather
than legacy DOS command files. ---Keith Medcalf
Thanks, Keith. Interested readers can look up "CMD" (without the quotes) in the XP help system; or see: http://tinyurl.com/fc2tu .
