一個(gè)擴(kuò)展時(shí)間段的dir命令的vbs腳本
更新時(shí)間:2008年05月20日 22:12:56 作者:lcx
CMD下的dir好像沒(méi)法列出從某段時(shí)間到某段時(shí)間的文件,所以寫(xiě)了這個(gè)小東東,方便根據(jù)我們的要求顯示數(shù)據(jù)
核心代碼
set Arg=Wscript.Arguments If Arg.Count=0 then Wscript.echo chr(9)&chr(9)&space(4)&"Xdir v0.1" Wscript.echo "" Wscript.echo chr(9)&"cscript dir.vbs path time1 time2 ext" Wscript.echo chr(9)&"cscript dir.vbs d:\test 20080101 20080430 doc" Wscript.Quit End If Path=Arg(0) Time1=Arg(1) Time2=Arg(2) Ext=Arg(3) FileTotal = 0 DirTotal = 0 FileTotalsize=0 TimeSpend = Timer myFind Path TimeSpend = round(Timer - TimeSpend,2) txtResult = "搜索完成!" & vbCrLf & "共找到文件:" & FileTotal & "個(gè)." & vbCrLf & "共搜索目錄:" & DirTotal & "個(gè)." &vbcrlf&"文件總數(shù)大小"&FormatNumber(FileTotalsize/1024,0)&"kB"& vbCrLf & "用時(shí):" & TimeSpend & "秒." wscript.echo txtResult Sub myFind(ByVal thePath) Dim fso, myFolder, myFile, curFolder Set fso = wscript.CreateObject("scripting.filesystemobject") Set curFolders = fso.getfolder(thePath) DirTotal = DirTotal + 1 If curFolders.Files.Count > 0 Then For Each myFile In curFolders.Files If InStr(1, LCase(Fso.GetExtensionName(myFile.Name)), ext) > 0 And Gtime(myFile.DateCreated) >Time1 And Gtime(myFile.DateCreated)<Time2 Then wscript.echo FormatPath(thePath) & "\" & myFile.Name FileTotal = FileTotal + 1 FileTotalsize = FileTotalsize + myFile.size End If Next End If If curFolders.subfolders.Count > 0 Then For Each myFolder In curFolders.subfolders myFind FormatPath(thePath) & "\" & myFolder.Name Next End If End Sub Function FormatPath(ByVal thePath) thePath = Trim(thePath) FormatPath = thePath If Right(thePath, 1) = "\" Then FormatPath = Mid(thePath, 1, Len(thePath) - 1) End Function Function Gtime(str) str=FormatDateTime(str,2) str1=Split(str,"-",-1,1) If len(str1(1))=1 then str11="0"&str1(1) If len(str1(2))=1 then str12="0"&str1(2) Gtime=str1(0)&str11&str12 End Function
這篇文章就介紹到這,希望大家以后多多支持腳本之家。
相關(guān)文章
Springboot Thymeleaf數(shù)據(jù)迭代實(shí)現(xiàn)過(guò)程
這篇文章主要介紹了Springboot Thymeleaf數(shù)據(jù)迭代實(shí)現(xiàn)過(guò)程,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2007-12-12用vbs返回 Internet Explorer 的下載控件和 Applet 的列表
用vbs返回 Internet Explorer 的下載控件和 Applet 的列表...2007-04-04用VBS實(shí)現(xiàn)一個(gè)小鍵盤動(dòng)作CTRL+V粘貼操作與思路分析
我想實(shí)現(xiàn)當(dāng)有跳出窗口"請(qǐng)輸入"時(shí)的1.8秒后就發(fā)送一次 CTRL + V,把本來(lái)已經(jīng)復(fù)制到剪切版中的文字自動(dòng)粘貼過(guò)去呢2009-12-12xp、2003開(kāi)3389+非net創(chuàng)建管理用戶+Shift后門+自刪除腳本vbs
喜歡VBS腳本的朋友可以下載使用。此腳本免殺,可以用于WebShell提供時(shí)使用,適用于2003系統(tǒng)和XP系統(tǒng)。2008-06-06利用VBS實(shí)現(xiàn)顯示系統(tǒng)服務(wù)列表
顯示服務(wù)列表的方法有很多,在接下來(lái)的文章中為大家介紹下利用VBS是如何實(shí)現(xiàn)的,感興趣的朋友不要錯(cuò)過(guò)2013-11-11