wwUtils::DeleteFiles

Deletes files given a wildcard path spec (ie. c:\temp\*.tmp) and a timeout or expiration value. This function is useful for quick clean up of temporary files created for Web display.

o.DeleteFiles(lcFileSpec, lnTimeout)

Parameters

lcFileSpec
A system file spec including wild cards.

lnTimeout
Timeout value - files prior to this timeout will be deleted.

Example

* ** Create Tempoary PDF files for linked display

lcCompany = UPPER(Request.Form("Company"))

SELECT * ;
   FROM TT_Cust ;
   WHERE UPPER(Company) = lcCompany ;
   ORDER BY Company ;
   INTO CURSOR TQuery

* ** WWC_WWPDF is defined in WCONNECT.H
* ** or you can override it here 
oPDF=CREATE([WWC_WWPDF])

lcFile = SYS(2015) + ".pdf"

* ** Print the report to a temporay Web Directory
oPDF.PrintReport("custlist.frx",Server.oConfig.owwDemo.cHTMLPagePath + "/temp/"+lcFile)

* ** Display link page and redirect
THIS.StandardPage("Report Complete",[<a href="/wconnect/temp/] + lcFile + [">] +;
                  [Click here to view the Customer Report</a>],,1,"/wconnect/temp/"+lcFile)

* ** Delete files that have 'timed out' (300 secs)
DeleteFiles(Server.oConfig.owwDemo.cHTMLPagePath + "temp/*.pdf",300)

See also:

Library wwUtils

© West Wind Technologies, 1996-2024 • Updated: 02/02/22
Comment or report problem with topic