您好,登錄后才能下訂單哦!
小編給大家分享一下服務器中如何根據創建日期和訪問日期清理文件,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
Function FilesTree(sPath) Set oFso = CreateObject("Scripting.FileSystemObject") Set oFolder = oFso.getfolder(sPath) Set oSubFolders = oFolder.SubFolders Set oFiles = oFolder.Files For Each oFile In oFiles 'WScript.Echo oFile.Path 'oFile.Delete fcdate = oFile.DateCreated fadata = oFile.DateLastAccessed If DateDiff("d", fcdate, fadata) > 0 Then 'after created, having accessed. If DateDiff("d", fadata, Now) > 90 Then oFile.Delete End If Else If DateDiff("d", fcdate, Now) > 90 Then oFile.Delete End If End If Next For Each oSubFolder In oSubFolders 'WScript.Echo oSubFolder.Path 'oSubFolder.Delete FilesTree (oSubFolder.Path) ' Next Set oFolder = Nothing Set oSubFolders = Nothing Set oFso = Nothing End Function FilesTree ("D:\Share")
看完了這篇文章,相信你對“服務器中如何根據創建日期和訪問日期清理文件”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。