Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBS Search by keyword for folder

Status
Not open for further replies.

Switchview

IS-IT--Management
Feb 11, 2012
2
NL
Hi All!

I'm looking for the following:

VBS script that search for a networkfolder by keyword.
For example:

1) Double click the vbs
2) Inputbox where you can type the keyword
3) Script searches for the foldername on \\server001\data$

If found then msgbox "Found folder"
Else msgbox "Folder not found"

I'm not sure where to start...
Does anyone has an working script somewhere ?

Kind Regards

Kevin
 
So far i've got this:
===================================================
CONST strDir = "\\FS01\Data"

set objShell = CreateObject("WScript.Shell")
set objFSO = CreateObject("Scripting.FileSystemObject")

function findFolder(strDir, strFlag)
set objFolder = objFSO.GetFolder(strDir)
for each objSubFolder in objFolder.SubFolders
if (inStr(objSubFolder.Name, strFlag)) then
findFolder = objSubFolder.Path
exit function
else
findFolder = findFolder (objSubFolder.Path, strFlag)
end if
next
end function

strFlag = inputBox("Enter partial directory name:")
MsgBox
===================================
I'm not sure what to write after the MsgBox.
I want the result to be prompted with something like "Folder Found". Or if not found "Folder not found
 
msgbox findFolder(strDir, strFlag)

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top