Link to home
Start Free TrialLog in
Avatar of FFNOKC
FFNOKCFlag for Afghanistan

asked on

Foxpro 7.0 "scan" sub directories

Hi,

I have a directory containing a whole slew of folders. Each of these folders contains several FoxPro databases. What I am trying to do is access a DBF of a certain name in each of the folders. Then sum up a certain field in the dbf, and store it in another table. What I need help with is parsing though each of the directories. Pseudocode might look like this:

For each folder in directory X
      set strD = Directory_name
      use sales.dbf
      Sum amount to X1
      copy strD to table Y
      copy X1 to table Y
Next Folder

Thanks for your help experts.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FFNOKC

ASKER

pcelba,

When I run this code I get an error saying laDirs is not an array. Does it need to be specifically dimensioned first? I thought VFP automatically created and sized arrays as needed.
I supposed it as well...

So, please change the first line to:

LOCAL lcBaseFolder, lnDirs, laDirs[1], lnI, lcDir, lnSum
The laDirs can be an array of any dimension, it can even be missing (then private array is created) but it cannot be a single variable prior to the ADIR() function call.

The interesting thing is I don't remember when this error occured in my code in the past...

OTOH, this error message prevents a certain kind of typo bugs in code.
Avatar of FFNOKC

ASKER

Thanks again. That worked, but it brought me to another question which I will post shortly. :)