WALK A DIRECTORY TREE USING VBSCRIPT
Does anyone know how to search a directory tree using vbscript, similar to NT Shell's
FOR /R loop? Any help would be greatly appreciated. Thanks much.
Windows Forum
Does anyone know how to search a directory tree using vbscript, similar to NT Shell's
FOR /R loop? Any help would be greatly appreciated. Thanks much.
by lo
Only in general but ...
Use the DIR command. Look in the help (under Functions) for argument that will help and specifics). It will return files (all or specific) given a path and file specification.
Not sure exactly where/how, but there is a way to determine that a returned value is a directory. For each direcory, make that the current path, and perform the function again.
You need to keep track of which path was working each time you start a new one so you can pick up the next when that one completes.
A generic skeleteon:
1) Set beginning directory to search
2) get next file from this dir
3) no files left? and higher level exists?
pull previous level back as current,
start at 2
4) if not desired file
5) if file a directory
6) save current position (value of DIR function in (2))
7) make this directory path current search
8) mark ths search that a higher level
exists
9) else if file is desired file (processing)
A) back to 2
Above may have some logic flaws (what do you want in 10-15 minutes), but should give you the basic idea.
by hc_74
Lookup the FileSystemObject.
It might have what you want.
by hc_74
by jay_patrick
here's a windows scripting file that recurses thru folders, it uses javascript but should be easy to convert to vbs, hope it helps
by hc_74
by kgosnell
Use the script to quiry the onboard application that is used by the assigned operator program, as using VBscript is a security issue, now that "Code Red" has opened pandoras box, if you persist in using a scripting protocol , the remedies for such as "Code Red" will make them obsolete, better using a string comand with the scipt as an actuator. This issue with the HTTP breakdown is only the tip of what can be done to trash security, and it's at the door, there are too many , too smart, that "Will" write script of some sort, so you must be conscious of the issues to progress. I hope this helps, as I see it , there will have to be a method to hover that "Sees" the registry and other critical data in real time, and can halt changes that wil alter the platforms function.
In any case , the latter is my opinion, and likely not the opinion of the ones who demand action now.
Good luck
by hc_74
by hc_74
This discussion is closed to new replies.
Sort by Trending