小编给大家分享一下服务器中如何根据创建日期和访问日期清理文件,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。