Esse script tem o objetivo em ajudar localizar arquivos por extensão
Set objFolder = Nothing
‘ OpenTextFile Method needs a Const value
‘ ForAppending = 8 ForReading = 1, ForWriting = 2
Const ForAppending = 8
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objTextFile = objFSO.OpenTextFile(“c:\FS.txt”, 8, True)
strExtention = InputBox(“Informe a extensao a ser procurada”, “minha empresa”)
strComputer = “.” ‘strAnswer
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set colFiles = objWMIService. _
ExecQuery(“Select * From CIM_DataFile Where Extension = ‘” & strExtention & “‘”)
For Each objFile In colFiles
objTextFile.Write objFile.drive & objFile.Path & objFile.Filename & “.” & objFile.Extension & “;” & (((objFile.FileSize / 1024) / 1024) / 1024)
objTextFile.WriteLine
Next
objTextFile.Close
wscript.echo “Fim!!!!”