Wilson WindowWare Tech Support

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


How to Make Directory Listings

Keywords: 	  Make Directory Listings  dirlist dir

Method 1:
AddExtender("wsrch34i.dll")

fh=FileOpen("dirlist.txt","WRITE")
BoxOpen("Dir List maker","")

handle=srchInit("C:\","w93gp17s.w8f","","",16+32)    ; search for non0existant file name
while 1
   retval=srchNext(handle)
   if retval=="" then break
   if strsub(retval,strlen(retval),1)!="\" then continue
   FileWrite(fh,retval)
   BoxText(retval)
endwhile
srchFree(handle)
FileClose(fh)
Message("All","Doned")
exit

Method 2:
#DefineFunction UDFListDirs(handle,dir)
   ;uncomment to include hidden dirs
   ;IntControl(5,1,0,0,0)
   ;change to target directory
   DirChange(dir)
   topdir=DirGet()
   BoxText(topdir)
   FileWrite(handle,topdir)
   ;Get list of subdirectories
   dirlist=DirItemize("*.*")
   ;Process list
   dircount=ItemCount(dirlist,@tab)
   for xx=1 to dircount
      thisdir=ItemExtract(xx,dirlist,@tab)
      UDFListDirs(handle,thisdir)
   next
   ;bump up one directory level
   DirChange("..")
   return
#EndFunction


BoxOpen("Dir List Maker","")
handle=FileOpen("dirlist.txt","WRITE")
UDFListDirs(handle, "c:\bizdocs\incoming")
FileCLose(handle)
Message("","lisrdir complete")