WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

File Searcher
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Get Directories Only

Keywords: 	  directories only

Question:

I'm using the following init for searcher:
TopSrchDir = 'C:\WINDOWS\'
nHandle = srchInit(TopSrchDir,"*.*","",0,48) 
Is this correct if I only want it to recurse to get all directories and below?

Is there a more refined setting to do this, cuz this is really slow? As this picks up files as well as Dirs. I only really want to get all the Dirs.

Thanks

Answer:

Try...
AddExtender("wsrch34I.dll")
TopSrchDir = 'C:\WINDOWS\'
nHandle = srchInit(TopSrchDir,"XXXXXXX.XXXX","",0,48)

while 1
xxx=srchNext(nHandle)
if xxx=="" then break
pause("Found",xxx)
endwhile

srchFree(nHandle)
message("All","Doned")
Part of the trick is the XXXXXXXX.XXXX mask that should match NO files, so all you should see is directories.

Continuation...

Question:

How would I go about (explicitly, please) using the Search Extender to test for the existence of a folder or subfolder by name on a given drive volume?

I've attached my code, which doesn't work. I think I'm in the ballpark, but the synapses have not yet responded to the caffeine.

Answer:

If AddExtender("WSRCH34I.DLL") == @FALSE Then Message("Error", "There's a problem with WSRCH34I.DLL.")

drives = DiskScan(2)	   								;Tell us all the user's local drives
drvnum = ItemCount(drives,@tab)						;How many local drives are there?


BoxOpen("Searcher", "Initializing...")

For d = 1 To drvnum			
    drv = ItemExtract(d, drives, @tab)  			 ;Start searching 1st drive volume
    drvroot = StrCat(drv,"\")			   		 ;Gimme the root
    
    handle=srchInit(drvroot, "XXXX.XXX", "", 0, 48)	 ;Need a handle
    
    While 1
        hit = srchNext(handle) 						 ;Let's go searching
        If hit == ""         				  		 ;We're outtahere if we come up empty-handed
            Break
        Else
            BoxText(hit)
            if strupper(hit)==strupper("C:\My Download Files\") then Message("Found", hit)
        EndIf 
    EndWhile
Next

	srchFree(handle) 


Article ID:   W12559
Filename:   Searcher - How to get Directories only.txt
File Created: 2001:03:01:15:34:44
Last Updated: 2001:03:01:15:34:44