|
- Const strPath = "D:\baidui\TTASP\TXT"
- Dim objFSO
- Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
- Call Search (strPath)
- Response.Write "清理完毕!"
- Sub Search(str)
- Dim objFolder, objSubFolder, objFile
- Set objFolder = objFSO.GetFolder(str)
- For Each objFile In objFolder.Files
- If objFile.DateLastModified < (Now() - 5) Then '五天前的记录
- objFile.Delete(True)
- End If
- Next
-
- For Each objSubFolder In objFolder.SubFolders
- Search(objSubFolder.Path)
- ' 文件都清理了,现在看看
- ' 文件夹是否空的。
- If (objSubFolder.Files.Count = 0) Then
- objSubFolder.Delete True
- End If
- Next
-
- End Sub
复制代码
|
|