In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use vbs to achieve an extended time period of dir command, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Core code
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 = Timer myFind Path TimeSpend = round (Timer-TimeSpend) 2) txtResult = "search complete!" & vbCrLf & "find files altogether: & FileTotal &" search directories: "& DirTotal &". & vbcrlf& "total file size" & FormatNumber (FileTotalsize/1024,0) & "kB" & vbCrLf & "time:" & TimeSpend & "seconds." 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) 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 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 Thank you for reading this article carefully I hope the article "how to use vbs to achieve a dir command for an extended time period" shared by the editor is helpful to everyone. At the same time, I also hope that you can support it and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.