vbs 定时删除功能实现代码 |
本文标签:定时删除,vbs 参考代码一: 复制代码 代码如下: 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 参考代码二: 复制代码 代码如下: 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 do 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 |