Hi All,

I know the file name to delete, let assume "test.bat" file, but i dont know where exactly it present.
It can be in any drive C, D, E or any.
I have to search for that perticular file and have to delete it from every location wherever it will found.
can anybody gives some about how to write using VB script
0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Prepare the recursive function to search an file...this is very basic programming skill that you need...
Answered 09/15/2010 by: WSPPackager
Senior Purple Belt

Please log in to comment
Heres basic recursive

strFolder = "C:\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
WScript.Echo objFolder.Path
Set colFiles = objFolder.Files
For Each objFile In colFiles
WScript.Echo objFile.Path
Sub ShowSubFolders(objFolder)
Set colFolders = objFolder.SubFolders
For Each objSubFolder In colFolders
WScript.Echo objSubFolder.Path
Set colFiles = objSubFolder.Files
End Sub
Answered 09/26/2010 by: ditch_nz
Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity