Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Generic Searcher Example to Rummage through Directories to Find a File

Keywords:      searcher

Question:

I've looked at your searcher extender example, but can't get it to find any files except if they're in the root of my C:\ drive. Can you help me out?

Answer:

You need to specify the flag of "16" in the srchinit function, if you want to search recursively through directories, as in the following example:
;==================snip=====================
BoxOpen("File Finder","Initializing")

AddExtender("wsrch34I.dll")

hand=srchInit("C:\","WINBATCH.EXE","","",16)

c=0
fh=FileOpen("c:\temp\whereitis.txt","WRITE")

while 1	  
a=srchNext(hand)	  
  if a=="" then break	
  c=c+1 
  
  dd=FileYmdHms(a)   
  ss=FileSize(a)   
  ee=strfix(c," ",8)   
  dd=strfix(dd," ",22)	 
  ss=strfix(ss," ",12)	 
  line=strcat(ee,dd,ss,a)   
  FileWrite(fh,line)  
  
 ;Display(1,c,a)
endwhile

Message("Find Complete",a)
srchFree(hand)	

exit

Article ID:   W12554
Filename:   Generic Searcher Ex to Find a File Recursively.txt