通行证│用户名: 密码: 验证码: 验证码,看不清楚?请点击刷新验证码 爱心红客 电信网通铁通移动 在线
文章搜索:
热门搜索:红客 黑鹰 红客技术 安全动画 红客培训
首页 文章 软件 动画 资源 励志 论坛 邮箱 会员 军事 科技 博客 爱心红客 最近更新 800g资源
 业内新闻 漏洞公告 病毒公告 电脑知识 网络知识 菜鸟入门 攻防教程 黑客攻防 安全编程 工具使用 综合安全 个人安全 安全相关 Q Q安全 原创精华 红客人物 站内事件
您现在的位置: 爱国者安全网 >> 文章类 >> 红客教程 >> 网络编程 >> 文章正文
一个扩展dir命令的vbs脚本
责任编辑:酷酷の鱼   更新日期:2008-5-14
 
‘CMD下的dir好像没法列出从某段时间到某段时间的文件,所以写了这个小东东

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
  • 上一篇文章:
  • 下一篇文章: 没有了
  • 最近更新
    固顶文章 地震无情 黑鹰有情
    固顶文章 企业网络组建与维护班正式开课
    普通文章 韩网站被袭主谋是韩国人 曾未查明真相就赖中国
    普通文章 概念型rootkit让杀毒软件无可奈何
    普通文章 “磁碟机”病毒仍在肆虐 可造成网银密码被盗
    普通文章 注册表映像劫持让病毒没脾气
    普通文章 用JS解决网站防挂iframe木马的方案
    普通文章 系统重装防病毒再侵袭的五个技巧
    推荐文章 推荐:计算机密码最佳选择与管理技巧
    普通文章 新方法帮你识隐藏木马
    热门文章
    普通文章IDC:2007年UTM市场Fortinet居首
    普通文章五一后 当心“旅游照片”邮件
    普通文章全球每5秒钟内就有1个被病毒感染
    普通文章分析称微软雅虎周五谈判仍可能只开花不结果
    普通文章华尔街套利者:微软不会轻易放弃收购雅虎
    普通文章Perl Unicode “\Q...\E” 表达式缓冲区溢出漏洞
    普通文章雅虎股价周五上扬 与微软谷歌三角恋临近结局
    普通文章Novell GroupWise客户端 HTML注入及拒绝服务漏洞
    普通文章用python修改注册表干掉360safe
    普通文章社会工程学入侵三部曲
    精彩专题