Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get the total numbers of files of a folder
Message
From
03/10/2005 09:30:35
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01055451
Message ID:
01055487
Views:
14
Ravi

I think arrays are seldom a good choice. VFP's cursor is more powerful and VFP's collection of array functions could be bigger.

If all you want is a simple count of files...
*CountFiles.PRG
LPARAMETERS m.tcSkeleton
IF VARTYPE(m.tcSkeleton) # "C" ;
     OR EMPTY(m.tcSkeleton)
  *Invalid function, argument, type or count.
  ERROR 11
ENDIF

LOCAL ;
  m.lnCount, ;
  m.lcFile
m.lnCount = 0
*Get the first filename.
m.lcFile = SYS(2000,m.tcSkeleton)
*Continue until all files are processed.
DO WHILE NOT EMPTY(m.lcFile)
  m.lnCount = m.lnCount + 1
  *Get the next filename.
  m.lcFile = SYS(2000,m.tcSkeleton,1)
ENDDO

RETURN m.lnCount
Previous
Reply
Map
View

Click here to load this message in the networking platform