佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > vbs 定時(shí)刪除功能實(shí)現(xiàn)代碼

vbs 定時(shí)刪除功能實(shí)現(xiàn)代碼

熱門(mén)標(biāo)簽:檢查注冊(cè)表項(xiàng) 呼叫中心市場(chǎng)需求 鐵路電話系統(tǒng) 服務(wù)器配置 銀行業(yè)務(wù) 網(wǎng)站文章發(fā)布 美圖手機(jī) 智能手機(jī)

參考代碼一:

復(fù)制代碼 代碼如下:

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 = DirPathsubFolder.name
    objFSO.DeleteFolder(strPath)
    End If
    Next
End Function
Call DeleteLog( )
這樣在task Schdeuler里面schedule我的vbs程序就沒(méi)有報(bào)錯(cuò)啦。撒花,結(jié)貼~~

參考代碼二:

復(fù)制代碼 代碼如下:

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è)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
'===========================================================
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

您可能感興趣的文章:
  • php定時(shí)刪除文件夾下文件(清理緩存文件)
  • 使用mysql事件調(diào)度器定時(shí)刪除binlog
  • 使用vbs腳本定時(shí)刪除N天前的文件
  • Windows和Linux下定時(shí)刪除某天前的文件的腳本
  • Shell定時(shí)刪除指定時(shí)間之前的文件
  • 定時(shí)刪除一個(gè)文件夾內(nèi)的所有子文件夾和文件的方法

標(biāo)簽:滄州 河南 樂(lè)山 沈陽(yáng) 上海 長(zhǎng)治 紅河 新疆

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《vbs 定時(shí)刪除功能實(shí)現(xiàn)代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢(xún)

    • 400-1100-266
    工布江达县| 炎陵县| 牙克石市| 邻水| 萨迦县| 师宗县| 昌宁县| 濮阳县| 北京市| 旬阳县| 商丘市| 当阳市| 门源| 会理县| 延边| 辽中县| 临桂县| 长岭县| 菏泽市| 南部县| 宜兰市| 苍南县| 宁津县| 黄冈市| 惠来县| 天台县| 旌德县| 兴山县| 五大连池市| 巫山县| 章丘市| 偃师市| 朔州市| 安塞县| 赣州市| 若羌县| 云浮市| 唐海县| 石阡县| 方山县| 京山县|