核心代码
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
这篇文章就介绍到这,希望大家以后多多支持。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“一个扩展时间段的dir命令的vbs脚本”评论...
更新动态
2024年05月13日
2024年05月13日
- 选举日 Founders Day
- 剑与远征启程豹女角色介绍 豹女值得培养吗
- 歧路旅人大陆的霸者开局选哪条路 三支主线
- 鸣潮桃祁声骸推荐 声骸主副词条选什么好
- 星穹铁道2.2糖浆药水的故事怎么达成 糖浆药水的故事隐藏成就攻略
- 星穹铁道2.2黄金与机械表怎么达成 黄金与机械表成就攻略
- 星穹铁道2.2速度加快血糖升高怎么达成 速度加快血糖升高成就攻略
- 《传送门64》被取消后 作者正在制作新任天堂64游戏
- 《塞尔达传说:王国之泪》发售1周年!官方晒出贺图
- 《坦克世界》天蝎与其标志性风格一起上架特惠商城
- 张国荣1978-DAYDREAMIN[Polydor]【APE+CUE】
- ABC唱片《田纳西.尔尼福特.永远的田纳西.尼尔福特》HD德国版[WAV+CUE]
- 区瑞强1980-云外千峰(復黑王)(16bit-44.1kHz)FLAC
- 韩国球迷输不起!不满客队门将庆祝 扔瓶泄愤砸倒球员
- 斗鱼公告登热搜:电棍Otto辱骂Mlxg被封7天