手机
当前位置:查字典教程网 >脚本专栏 >vbs >一个扩展时间段的dir命令的vbs脚本
一个扩展时间段的dir命令的vbs脚本
摘要:setArg=Wscript.ArgumentsIfArg.Count=0thenWscript.echochr(9)&chr(9)&spa...

setArg=Wscript.Arguments

IfArg.Count=0then

Wscript.echochr(9)&chr(9)&space(4)&"Xdirv0.1"

Wscript.echo""

Wscript.echochr(9)&"cscriptdir.vbspathtime1time2ext"

Wscript.echochr(9)&"cscriptdir.vbsd:test2008010120080430doc"

Wscript.Quit

EndIf

Path=Arg(0)

Time1=Arg(1)

Time2=Arg(2)

Ext=Arg(3)

FileTotal=0

DirTotal=0

FileTotalsize=0

TimeSpend=Timer

myFindPath

TimeSpend=round(Timer-TimeSpend,2)

txtResult="搜索完成!"&vbCrLf&"共找到文件:"&FileTotal&"个."&vbCrLf&"共搜索目录:"&DirTotal&"个."&vbcrlf&"文件总数大小"&FormatNumber(FileTotalsize/1024,0)&"kB"&vbCrLf&"用时:"&TimeSpend&"秒."

wscript.echotxtResult

SubmyFind(ByValthePath)

Dimfso,myFolder,myFile,curFolder

Setfso=wscript.CreateObject("scripting.filesystemobject")

SetcurFolders=fso.getfolder(thePath)

DirTotal=DirTotal+1

IfcurFolders.Files.Count>0Then

ForEachmyFileIncurFolders.Files

IfInStr(1,LCase(Fso.GetExtensionName(myFile.Name)),ext)>0AndGtime(myFile.DateCreated)>Time1AndGtime(myFile.DateCreated)<Time2Then

wscript.echoFormatPath(thePath)&""&myFile.Name

FileTotal=FileTotal+1

FileTotalsize=FileTotalsize+myFile.size

EndIf

Next

EndIf

IfcurFolders.subfolders.Count>0Then

ForEachmyFolderIncurFolders.subfolders

myFindFormatPath(thePath)&""&myFolder.Name

Next

EndIf

EndSub

FunctionFormatPath(ByValthePath)

thePath=Trim(thePath)

FormatPath=thePath

IfRight(thePath,1)=""ThenFormatPath=Mid(thePath,1,Len(thePath)-1)

EndFunction

FunctionGtime(str)

str=FormatDateTime(str,2)

str1=Split(str,"-",-1,1)

Iflen(str1(1))=1thenstr11="0"&str1(1)

Iflen(str1(2))=1thenstr12="0"&str1(2)

Gtime=str1(0)&str11&str12

EndFunction

【一个扩展时间段的dir命令的vbs脚本】相关文章:

文件备份vbs脚本

定时自动备份IIS的WWW日志的vbs脚本

多进程的实现投票的vbs脚本

vbs病毒制作之一复制自身的vbs脚本

收集的一些经典的vbs脚本大全

利用vbscript的for命令实现定时关机

完整的注册表操作实例 VBS脚本

用VBS检测Guest状态的脚本

一个可以删除指定天数文件的vbs脚本

一个实现VBS倒计时的代码

精品推荐
分类导航