Function Deletelog ()
Dim objFSO, Objfolder, strpath, Targetfso, Subfso, Dirpath
Dirpath = CreateObject ("Scripting.FileSystemObject"). GetFile (Wscript.scriptfullname). parentfolder.path& "\log\"
Set objFSO = CreateObject ("Scripting.FileSystemObject")
Set Targetfso = Objfso.getfolder (Dirpath)
Set Subfso = targetfso.subfolders
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 ()
So in the task Schdeuler inside schedule My VBS program there is no error. Sprinkle flowers, knot paste ~ ~
Dim Dqxs, Dqrq, Szxs, SZFZ, DQML, DATP
Dim JCLB
Dim C
Dim d
'=========================================================
DATP = "F:"
Szxs = "7:00:"
WJML = DATP & "\dvrdat\"
sykj = 20000000000 ' 20 g
DQML = Left (Wscript.scriptfullname,instrrev (wscript.scriptfullname, "\")-1)
JCLB = "Servicesmanager.exe,pd_server.exe,speedserver.exe,coreserver.exe,downloadsvc.exe,managerconsole.exe, Gptsvr.exe,hintamproxy.exe,fileserver.exe,cleandisk.exe,getnetdata.exe,sguclient.exe,sguserver.exe, "
Set WshShell = WScript.CreateObject ("Wscript.Shell")
Set FSO = WScript.CreateObject ("Scripting.FileSystemObject")
'=========================================================
If FSO. Getdrive (DATP). FreeSpace < sykj then call CPRLQL
Todo
If InStr (Time, Szxs) <> 0 Then
If FSO. Getdrive (DATP). FreeSpace < sykj then call CPRLQL
End If
Wscript.Sleep (60*1000)
Loop
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