一個擴展時間段的dir命令的vbs腳本
來源:本站原創(chuàng)|時間:2020-01-10|欄目:vb|點擊: 次
核心代碼
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 & "個." & vbCrLf & "共搜索目錄:" & DirTotal & "個." &vbcrlf&"文件總數大小"&FormatNumber(FileTotalsize/1024,0)&"kB"& vbCrLf & "用時:" & 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
這篇文章就介紹到這,希望大家以后多多支持我們。
上一篇:用vbs實現(xiàn)向任何電子郵件發(fā)送郵件
欄 目:vb
下一篇:用vbs實現(xiàn)的exe2swf工具腳本代碼
本文標題:一個擴展時間段的dir命令的vbs腳本
本文地址:http://mengdiqiu.com.cn/a1/vb/7741.html
您可能感興趣的文章
- 01-10什么是一個高效的軟件
- 01-10VBS教程:運算符-賦值運算符 (=)
- 01-10VBS教程:函數-Year 函數
- 01-10VBS教程:函數-Eval 函數
- 01-10VBS教程:函數-Join 函數
- 01-10[vbs]每一行的最后一個字符轉換成
- 01-10一個可以更換windows xp or 2003的序列號的vbs腳本
- 01-10一個可以刪除指定天數文件的vbs腳本
- 01-10使用ADSI、ASP和一對魔術戲法自動地創(chuàng)立一個虛擬目錄的方法
- 01-10按鍵精靈 腳本-學習VBS的一個不錯的教程


閱讀排行
本欄相關
- 01-10下載文件到本地運行的vbs
- 01-10飄葉千夫指源代碼,又稱qq刷屏器
- 01-10SendKeys參考文檔
- 01-10什么是一個高效的軟件
- 01-10VBS中的正則表達式的用法大全 &l
- 01-10exe2swf 工具(Adodb.Stream版)
- 01-10VBS中SendKeys的基本應用
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript教程 第十一課深入VBScript
- 01-10VBScript語法速查及實例說明
隨機閱讀
- 01-10C#中split用法實例總結
- 08-05dedecms(織夢)副欄目數量限制代碼修改
- 08-05織夢dedecms什么時候用欄目交叉功能?
- 01-10delphi制作wav文件的方法
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 04-02jquery與jsp,用jquery
- 01-10SublimeText編譯C開發(fā)環(huán)境設置
- 01-11ajax實現(xiàn)頁面的局部加載
- 01-10使用C語言求解撲克牌的順子及n個骰子
- 08-05DEDE織夢data目錄下的sessions文件夾有什