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

Files and Directories

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

UDF - Find a File

Keywords: 	 UDF - Find a File 

#DefineFunction FindMyFile(dir,DaFile)
   origdir=DirGet()
   DirChange(dir)
   if FileExist(dafile)
      retval=strcat(DirGet(),DaFile)
   else
      dirlist=DirItemize("*.*")
      dircount=ItemCount(dirlist,@tab)
      retval=""
      for xx=1 to dircount
         thisdir=ItemExtract(xx,dirlist,@tab)
         retval=FindMyFile(thisdir,DaFile)
         if retval!="" then break
      next
   endif
   DirChange(origdir)
   return(retval)
#EndFunction



lookfor="index.html"
dirstart="c:\bizdocs\incoming\"   ; \ on end !!!

MyFullFileName=FindMyFile(dirstart,lookfor)

if MyFullFileName==""
   Message(lookfor,"not found")
else
   Message("Found",MyFullFileName)
endif



Article ID:   W15752
File Created: 2003:05:13:11:29:56
Last Updated: 2003:05:13:11:29:56