最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

一個(gè)擴(kuò)展時(shí)間段的dir命令的vbs腳本

 更新時(shí)間:2008年05月20日 22:12:56   作者:lcx  
CMD下的dir好像沒法列出從某段時(shí)間到某段時(shí)間的文件,所以寫了這個(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)文章

最新評論

津南区| 西吉县| 巴楚县| 通海县| 渝中区| 开江县| 兴宁市| 兴仁县| 贡嘎县| 屯昌县| 南宁市| 屯昌县| 兴国县| 深圳市| 东阳市| 长治县| 江孜县| 高要市| 阿鲁科尔沁旗| 喀喇| 丘北县| 万载县| 讷河市| 郧西县| 西安市| 庆元县| 威宁| 朔州市| 旬邑县| 隆尧县| 麻城市| 德阳市| 长子县| 温宿县| 辽宁省| 会泽县| 惠东县| 固始县| 商丘市| 微山县| 任丘市|