时间:2021-05-25 08:21:32 | 栏目:VBS | 点击:次
参考代码一:
For Each subFolder in SubFSO
If DateDiff("d", subFolder.name, date)>3 Then
strPath = DirPath&subFolder.name
objFSO.DeleteFolder(strPath)
End If
Next
End Function
Call DeleteLog( )
这样在task Schdeuler里面schedule我的vbs程序就没有报错啦。撒花,结贴~~
参考代码二:
getfso=fso.GetFolder("c:\\windows").DateCreated
'===========================================================
Function cprlql
Dim strline, scml
WshShell.run "cmd /c dir " & wjml &" /ad /b /tc>c:\dir.log",0
if fso.FileExists("c:\dir.log") then
Set objFile = fso.OpenTextFile("c:\dir.log")
do until objFile.atendofstream
strline = objFile.readline
scml = wjml & strline
WshShell.run "cmd /c rd /s /q " & scml,0
for i = 1 to 20
if fso.GetDrive(datp).FreeSpace > sykj then exit Function
if fso.FolderExists(scml) then
WScript.Sleep(1000)
else
exit for
end if
next
if fso.GetDrive(datp).FreeSpace > sykj then exit Function
loop
end if
End Function