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

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

 更新時間:2008年05月20日 22:12:56   作者:lcx  
CMD下的dir好像沒法列出從某段時間到某段時間的文件,所以寫了這個小東東,方便根據(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 & "個." & vbCrLf & "共搜索目錄:" & DirTotal & "個." &vbcrlf&"文件總數(shù)大小"&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 

這篇文章就介紹到這,希望大家以后多多支持腳本之家。

相關(guān)文章

最新評論

永康市| 广元市| 湘乡市| 莲花县| 周宁县| 甘孜| 宁化县| 静安区| 五峰| 景德镇市| 嘉荫县| 陇西县| 宁海县| 琼结县| 舟曲县| 桦川县| 永嘉县| 本溪市| 焦作市| 绥阳县| 铜川市| 客服| 定襄县| 微博| 民勤县| 夏河县| 自贡市| 三亚市| 鹤山市| 长沙市| 康平县| 绥化市| 武功县| 六盘水市| 三门峡市| 丰都县| 平定县| 巩留县| 获嘉县| 满洲里市| 乌拉特中旗|