blkpawns, on Aug 9 2005, 03:41 PM, said:
You can have it output messages if you want. You just have to place
them in the right spot. Here is a vbs script that you type in the extention
to list all the files with that extention. It uses the WMI to search all local
hard drives. It produces a report of the all files with the extention and
there location.
Quote
Dim Act : Set Act = CreateObject("Wscript.shell")
Sd = Act.ExpandEnvironmentStrings("%systemdrive%")
Ftype = InputBox("Type In The File Extention Of The The file Type That You Want To Search For" & vbCrlf & vbCrlf & "This Can Take A Few Minutes To Complete, The Time It Take To Complete Depends, On How Large The Drives Are And How Many Files There Are Of The Type You Input." & vbCrlf & VbCrlf & "Example = BMP or bmp" & space(3) & "DLL or dll" & space(3) & "EXE or exe" & Vbcrlf & "No Period Is Needed For The Extentions","Gsm List File Type")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = '" & Ftype & "'")
If colFiles.Count = 0 Then
Act.popup "There Was No File Found With That extention", 5, "No File Found", 0 + 64
Wscript.Quit
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(Sd & "\" & Ftype & ".txt")
For Each objFile in colFiles
objTextFile.Write("-----------------------------------------" & vbCrlf & objFile.Drive & objFile.Path)
objTextFile.Write(objFile.FileName & "." & objFile.Extension & vbCrLf & "File Size=")
objTextFile.Write(objFile.FileSize & vbCrLf & "-----------------------------------------" & vbCrlf)
Next
objTextFile.Close
Act.Popup "Completed The Script", 4, "List All The " & Ftype, 0 + 32
Act.run (SD & "\" & Ftype & ".txt"),1,True
A1 = Act.Popup("Would You Like To Keep The File" & vbCrLf & "Would You Like To Delete The File" & vbCrLf & "Yes To Keep The File" & vbCrLf & "No To Delete The file" & vbCrLf & "Defualt Time Out Action Is To Keep The File", 7, "Keep Or Delete", 4 + 32)
If A1 = 6 Then
Act.popup "Keeping The File" & vbCrLf & Ftype & ".txt", 4, "User Save" & Space(5) & Ftype & ".txt", 0 +32
End If
If A1 = 7 Then
CreateObject("Scripting.FileSystemObject").deletefile(Sd & "\" & Ftype & ".txt")
Act.popup "User Selected To Delete The File" & vbCrLf & Sd & "\" & Ftype & ".txt", 4, "User Deleted" & Space(5) & Ftype & ".txt", 0 +32
end If
If A1 = -1 Then
Act.popup "Time Out Occur Performing The Defualt Action" & vbCrlf & "Keeping The " & Sd & "\" & Ftype & ".txt", 4, "Keeping" & Space(5) & Ftype & ".txt", 0 +32
End If
On Error resume Next
CreateObject("Scripting.FileSystemObject").deletefile(Sd & "\ListFile.vbs")
This post has been edited by gunsmokingman: 10 August 2005 - 02:32 PM