• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >vbs > 一个扩展时间段的dir命令的vbs脚本

一个扩展时间段的dir命令的vbs脚本

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了dir命令,dir命令详解,dos dir命令,dir命令参数,linux dir命令等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
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
</div>

您可能想查找下面的文章:

  • 切换dos并dir的vbs
  • 一个扩展时间段的dir命令的vbs脚本

相关文章

  • 用vbs判断一个日期是否在指定的时段内
  • getSQLinfo.vbs 获得SQL数据/日志空间使用情况的脚本
  • VBS中的标识符(Identifiers)
  • 右键发送(sendto),创建快捷方式到自定义的位置 的vbs
  • VBS相册生成脚本[
  • vbs向指定的文件添加内容的函数
  • vbs判断磁盘类型和检测硬盘剩余空间的实现代码
  • VBS模拟POST上传文件的代码
  • VBScript 算一算你从出生到现在共计多少天
  • 提供个可以显示农历的VBS代码

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • adodb.stream读文件到数组的代码
    • VBS获取当前目录下所有文件夹名字的代码
    • vbs通过WMI修改文件文件夹的NTFS权限
    • vbscript 读取xml格式的配置文件
    • LCL.VBS 病毒源代码
    • VBScript 打造自己的远程CMDShell附使用教程
    • 当某IP 连接我机器的3389端口 报警的脚本
    • vbs中获取脚本当前路径的2个方法
    • 用vbs实现向任何电子邮件发送邮件
    • 使用SAFEARRAY返回的代码

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有