Page 2 of 2 <12
Topic Options
#49298 - 2000-03-30 02:07 PM Re: del *.tmp in C:\windows\temp
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
A short version doing the job in NT and 9x

code:

If @InWin = 1
Shell "%COMSPEC% RD /S /Q %TEMP%"
EndIf
If @InWin = 2
Shell "%COMSPEC% DelTree /Y %TEMP%"
EndIf


Just another way of doing the job if you don't want to call functions outside the script
(You need at least kix version 3.62 to run this script)

code:

CD %TEMP%
GoSub DelTmpDir
Return ; Script finished


; **************************
elTmpDir
; **************************

Dim $SubDir

$FileName = Dir("*.*")
While $FileName <> "" And @Error = 0
If SubStr($FileName, 1, 1) <> "."
If GetFileAttr($FileName) & 16
$SubDir = $FileName
CD $SubDir
GoSub DelTmpDir
CD ".."
$FileName = Dir("*.*")
While $FileName <> $SubDir
$FileName = Dir()
Loop
$Err = SetFileAttr($SubDir, 128)
RD $SubDir ; Delete subdirectory, now empty
Else
$Err = SetFileAttr($FileName, 128)
Del $FileName
EndIf
EndIf
$FileName = Dir()
Loop
Return
; *** END SUB DelTmpDir ***




Top
#49299 - 2000-03-30 02:54 PM Re: del *.tmp in C:\windows\temp
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
My script for doing the job if you don't want to call functions outside the script was disturbd by a smiley,
So here's the version without a smiley (I hope)

code:
Break On
CD %TEMP%
GoSub DelTmpDir
Exit ; Script finished

; **************************
elTmpDir
; **************************

Dim $SubDir

$FileName = Dir("*.*")
While $FileName <> "" And @Error = 0
If SubStr($FileName, 1, 1) <> "."
If GetFileAttr($FileName) & 16 ; $FileName is a subdirectory
$SubDir = $FileName
CD $SubDir
GoSub DelTmpDir
CD ".."
$FileName = Dir("*.*")
While $FileName <> $SubDir
$FileName = Dir()
Loop
$Err = SetFileAttr($SubDir, 128)
RD $SubDir ; Delete subdirectory, now empty
Else
$Err = SetFileAttr($FileName, 128)
Del $FileName
EndIf
EndIf
$FileName = Dir()
Loop
Return
; *** END SUB DelTmpDir ***



Top
#49300 - 2000-03-31 06:47 AM Re: del *.tmp in C:\windows\temp
Anonymous
Unregistered


I found the sollution i think.
I placed the line
ECHO y|del %temp%\*.*
directly in the autoexec.bat and on win9x and winNT its running.
only its not deleting the subdirectory's.

Nick

Top
#49301 - 2000-03-31 07:15 AM Re: del *.tmp in C:\windows\temp
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
kholm...

well done !

shawn.

Top
#49302 - 2000-03-31 08:39 AM Re: del *.tmp in C:\windows\temp
Anonymous
Unregistered


Ok, it has gone on long enough

In your autoexec.bat

echo y| deltree c:\temp
md c:\temp



Top
#49303 - 2000-04-01 01:14 AM Re: del *.tmp in C:\windows\temp
Anonymous
Unregistered


gentleman,

pardon me for butting in, i use a tiny freeware dos app. called 'locate.com'.
Just call this with the 'run' function
with the following parameters;

locate.com c:\windows\temp\*.* /k/y

it doesnt seem to slow down the login script noticably. even then, i only have it run depending on the day and time of day.
search the web for 'locate.com', works fine in dos, win9x and nt.

Top
#49304 - 2000-04-21 09:37 AM Re: del *.tmp in C:\windows\temp
Anonymous
Unregistered


Did anyone try the /Q and/or /F options with Del (force and quiet mode)?? Works for me...

Of course this from a DOS prompt/regular batch file...

Top
#49305 - 2000-04-21 11:56 AM Re: del *.tmp in C:\windows\temp
Anonymous
Unregistered


I can't beleive these threads !
Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.056 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org