Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting files over x days old? 1

Status
Not open for further replies.

gbaughma

IS-IT--Management
Staff member
Nov 21, 2003
4,772
11
38
58
US
I'm building a report in ASP (with hand-made pivot tables, but that's not the issue).

Anyway.... I need to give the user the ability to get the report data (which is in an HTML table) in a CSV format.

Scenario 1:
Find a piece of client-side Javascript that would read the HTML table and export it as a .CSV file.

Scenario 2:
Write a CSV file at the same time that I'm building the HTML table. However, I would need to delete the "old" CSV files off of the server (probably at the time that the page is loading)

So, the question for scenario 2 is:
Anybody know how I can do a delete *.CSV for files that are > 1 day old?



Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
something like this:
Code:
Dim stPath, dtmToday

stPath = "C:\a_a\computers.txt"
dtmToday = Date 

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(stPath)
stLongDate = objFile.DateLastModified
DateArray = Split(stLongDate, " ")
stShortDate  = DateArray(0) 
msgbox date 
difff = DateDiff("d",stshortdate,Date)
if difff > 1 then
do something
end
 
  • Thread starter
  • Moderator
  • #3
That looks like it.... have a *

:)


Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top