复制代码 代码如下:
ConstFilePath="E:\log"'定义目录
SetFSO=CreateObject("Scripting.FileSystemObject")
ShowSubfoldersFSO.GetFolder(filepath)
SubShowSubFolders(Folder)
ForEachSubfolderinFolder.SubFolders
SetFiles=subfolder.Files
IfFiles.Count<>0Then
ForEachFileInFiles
IfFile.DateLastModified<Now-30Then'判断是否超过30天
FSO.DeleteFile(Subfolder.Path&"\"&File.Name)'删除
'Wscript.EchoSubfolder.Path&"\"&File.Name'显示
EndIf
Next
EndIf
ShowSubFoldersSubfolder
Next
EndSub
