# Batch File

#### ]SK[

##### One of Freddy's beloved
Anyone think this is possible?

I want to delete all *.ztmp files. Can I make the batch search though subfolders and delete any .ztmp files it finds?

Last resort would be to add each subfolder, which will take a long time

#### sibanac

##### Fledgling Freddie
on unix :

Code:
find / -name \*.ztmp  -ok rm {} \;
on windows i havent got any idee except using the search and then deleting all the results manualy

#### babs

##### Can't get enough of FH
Del x:\*.ztmp /s (/p if you want a y/n prompt), obviously replacing x for whichever drive you want.

I love you

#### ]SK[

##### One of Freddy's beloved
Is there a way to output the deleted info into a txt file as well as onscreen?

The batch is this atm...

Code:
@ECHO OFF
Echo *  This little batch file will clean out	*
Echo *  temporary ztmp files created from clients	*
Echo *  If you do not wish to continue close		*
Echo *  this window.					*
Echo *  This script is written thinking your HLDS	*
Echo *  installation is installed in c:\hlserver		*
Echo -
pause
cd c:\
cd hlserver
Echo Deleting ztmp files...
Echo -
del *.ztmp /s
Echo -
Echo OK All clean!
pause

#### Shovel

##### Part of the furniture
Yes

Add the following to the del command:
Code:
del *.ztmp /s > X:\path\to\output.log
Just make sure that the script is flawless first, since any prompts will also get redirected into the log file.

If you want the same log file to have the data appended (rather than a new log file every time - you could for instance make a dynamic name using DATE or something) then replace with something like this:
Code:
echo >> output.log
date /t >> output.log
del *.ztmp /s >> output.log
Note the ">>" rather than ">". The ">>" means "Append" rather than writing a new file.

I hope that works for you

#### ]SK[

##### One of Freddy's beloved
Ah I did do it right but I was looking in the wrong place

Is there a way to make the log appear in the same place as where the batch is?

#### babs

##### Can't get enough of FH
Just specify the path before the log file name.

e.g. if .bat is in c:\files\temp\ then del *.ztmp /s >> c:\files\temp\output.log

#### ]SK[

##### One of Freddy's beloved
Yeah but I meant if the batch file moved from a directory, without having to type the path in again?

#### Scouse

##### Job-worshipper and all round follower of cunts.
FH Subscriber
Jeesus you're picky

#### Shovel

##### Part of the furniture
It should work if you just specify ".\output.log" as the log file and specify the full path for the del command. Then just run the script and it should appear alongside the script file.

#### babs

##### Can't get enough of FH
yup, just prefix with .\