Next: purgelog.mak Up: Code Listing Previous: httpdutl.bas

purgelog.bas


'
'  Author:  Terence Kelly
'  Date:    8 September 1995
'
'  This module serves exactly one purpose:  It produces an
'  executable which deletes all .LOG files in the WEBRTI
'  session log directory.
'

Global Const Pat$ = "C:\HTTPD\HTDOCS\WEBRTI\SESSION\*.LOG"

Sub Main ()
    '
    '  Delete all files that match pattern.  This is a good
    '  sample cgi-bin program.  It's about as simple as can
    '  be.
    '
    '  The error handler is important in order to prevent
    '  Visual Basic's annoying error message boxes from popping
    '  up on the server console screen, thus effectively crippling
    '  the server.  We just ignore errors.
    '

    On Error GoTo Main_Error

    C$ = CRLF()
    out$ = Split(Command$, 3, " ")
    before$ = Trim$(Str$(NumFiles(Pat$)))
    Kill (Pat$)
    after$ = Trim$(Str$(NumFiles(Pat$)))
    T$ = "PURGELOG report"
    B$ = HTML_H1("PURGELOG reports:") & C$
    B$ = B$ & "<p>" & C$ & "Number of files matching "
    B$ = B$ & Pat$ & " before deletion: "
    B$ = B$ & before$ & ".  After deletion: " & after$ & "."
    B$ = B$ & "</p>" & C$
    R$ = HTML_Document(T$, B$)
    Call ClobberFile(out$, R$)

Exit Sub

Main_Error:
    Resume Next

End Sub


tpkelly@cs.CS.Princeton.EDU
Thu Sep 14 02:35:48 EDT 1995