服务器中如何根据创建日期和访问日期清理文件
小编给大家分享一下服务器中如何根据创建日期和访问日期清理文件,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
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")
看完了这篇文章,相信你对“服务器中如何根据创建日期和访问日期清理文件”有了一定的了解,如果想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!