I have a program that generates a report, saves them to a directory (just in case), then emails it out to a specified list. What i'd like to do is delete the files that are more than a week or so old. I did some searching and found this script but i get an error.
VB Code:
Dim ofile As File Dim ofolder As Folder Dim ofso As FileSystemObject Set ofso = New FileSystemObject Set ofolder = ofso.GetFolder("C:\temp") [hl=#FFFF99]For Each ofile In ofolder[/hl] If DateDiff("d", ofile.DateCreated, Now) > 7 Then If Mid(ofile.ShortName, InStrRev(ofile.ShortName, ".")) = ".txt" Then ofile.Delete False End If End If Next Set ofile = Nothing Set ofolder = Nothing Set ofso = Nothing
The error i get is on the highlighted line. The Error i get is a message about object does not support this property or method.
Thanks
Andy




Reply With Quote