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.

FileCount UDF

Keywords: 	 FileCount UDF

#DefineFunction UDFFileCount(dir)
   ;Include hidden files
   ;removed IntControl(5,1,0,0,0)

   ;change to desired directory
   DirChange(dir)
   topdir=DirGet()

   ;Count all files in desired directory
   filcount=ItemCount(FileItemize("*.*"),@tab)

   ;Get list of subdirectories
   dirlist=DirItemize("*.*")

   ;Process list
   dircount=ItemCount(dirlist,@tab)
   for xx=1 to dircount
      thisdir=ItemExtract(xx,dirlist,@tab)
      filcount=filcount+UDFFileCount(thisdir)
   next

   ;bump up one directory level
   DirChange("..")
   return (filcount)
#EndFunction

count=UDFFileCount("c:\bizdocs\incoming\")
Message("FileCount",count)






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