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!

Function to delete file over x days old

Status
Not open for further replies.

newcoder54

Technical User
Jul 2, 2002
46
0
0
US
Just need a idea to kill a file if over so many days old.

Something like this:

Function KillOldFile()

If C:\My Documents\MyFile.xls is over 3 days old then
Kill

End Function.

I know its simple but still over my head as a user. Thanks
 
Something like this ?
Sub KillOldFile(strPathname As String)
If FileDateTime(strPathname) < Date() - 3 Then
Kill strPathname
End If
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top