Hello,
I have a routine that processes tables with indexes. I did this by using

ADIR(thearray,'*.*','AHRSD')

and then walking the array, searching for either a CDX file to process or a
subdirectory to recurse into.
Unfortunately it trips up on larger directories with a memory error trying
to execute the ADIR().

I decided to take a listing of subdirectories and CDX files to make the
resulting array much smaller. How can I do this though? At first I tried

ADIR(thearray,'*.CDX','AHRSD')

but that will only include directory names that match the file skeleton (ie
end in '.CDX'; which they don't.) Next I tried creating two arrays, one for
CDX files with ADIR(filearray,'*.CDX','AHRS) and one for subdirectories with
ADIR(dirarray,'*.*','D') but the latter matches all the files and
directories which is prone to memory errors.

Is it possible to get an array of all CDX files and all directories without
creating an array of everything and filtering it in Fox code?
This is FPW2.6a.

--
TIA
Andrew Howell

Re: FPW2.6a and ADIR by Andrew

Andrew
Wed Jun 30 03:06:00 CDT 2004

Andrew Howell wrote:
> Hello,
> I have a routine that processes tables with indexes. I did this
> by using
>
> ADIR(thearray,'*.*','AHRSD')
>
> and then walking the array, searching for either a CDX file to
> process or a subdirectory to recurse into.
> Unfortunately it trips up on larger directories with a memory error
> trying to execute the ADIR().

A quick thought I just had:
would the memory errors disappear with

MVCOUNT=65000

(or similar) in the config.fpw ? At the moment there is no MVCOUNT in the
config.fpw and the helpfile says it defaults to 256.

Any ideas?

--
TIA
Andrew Howell



Re: FPW2.6a and ADIR by Gregory

Gregory
Wed Jun 30 03:14:01 CDT 2004

Andrew,

Two arrays

ADIR(thearray,'*.CDX','AHRS') for the cdx, and
ADIR(onotherarray, '', 'D') for the subdirectories

(tried on vfp6)

Gregory
___________________________________________________________________________


"Andrew Howell" <ajh@work> wrote in message
news:%23JeiGdnXEHA.2520@TK2MSFTNGP12.phx.gbl...
> Hello,
> I have a routine that processes tables with indexes. I did this by
using
>
> ADIR(thearray,'*.*','AHRSD')
>
> and then walking the array, searching for either a CDX file to process or
a
> subdirectory to recurse into.
> Unfortunately it trips up on larger directories with a memory error trying
> to execute the ADIR().
>
> I decided to take a listing of subdirectories and CDX files to make the
> resulting array much smaller. How can I do this though? At first I tried
>
> ADIR(thearray,'*.CDX','AHRSD')
>
> but that will only include directory names that match the file skeleton
(ie
> end in '.CDX'; which they don't.) Next I tried creating two arrays, one
for
> CDX files with ADIR(filearray,'*.CDX','AHRS) and one for subdirectories
with
> ADIR(dirarray,'*.*','D') but the latter matches all the files and
> directories which is prone to memory errors.
>
> Is it possible to get an array of all CDX files and all directories
without
> creating an array of everything and filtering it in Fox code?
> This is FPW2.6a.
>
> --
> TIA
> Andrew Howell
>
>
>


Re: FPW2.6a and ADIR by Andrew

Andrew
Wed Jun 30 04:07:12 CDT 2004

Gregory Adam wrote:
> Andrew,
>
> Two arrays
>
> ADIR(thearray,'*.CDX','AHRS') for the cdx, and
> ADIR(onotherarray, '', 'D') for the subdirectories
>

Thanks for the idea Gregory,
unfortunately the second command only returns current and parent
directory ("." and "..") in FPW2.6 so instead I've modified it to include
everything with no extension:

ADIR(onotherarray, '*.', 'D') for the subdirectories

It's not ideal since it will miss directories with an extension; it just so
happens that we don't have any of those where this runs. I should perhaps
expand it to do 'AHRSD' since directories can be 'hidden', 'archive', 'read
only' and maybe even 'system'. We'll see.. This program is run monthly by
another user and every time he does it, it seems to go wrong for one reason
or another. Originally I had a long list of hardcoded directories that it
processed one by one. It all went wrong when I swapped that for a routine
that took one directory and recursed all subdirectories.

--
Thanks
Andrew Howell



Re: FPW2.6a and ADIR by Gregory

Gregory
Wed Jun 30 04:53:30 CDT 2004

Andrew,

What I see over here is (vfp6)

? adir(xxx, 'c:\project\', 'D') && returns 2, ie . and ..
but
cd c:\project
? adir(xxx, '', 'D') returns 18 including . and ..

Looks like you have to be in the directory for adir(xx, '', D') to work

Maybe worth a try

Gregory
_______________________

"Andrew Howell" <ajh@work> wrote in message
news:OdNsAJoXEHA.2520@TK2MSFTNGP12.phx.gbl...
> Gregory Adam wrote:
> > Andrew,
> >
> > Two arrays
> >
> > ADIR(thearray,'*.CDX','AHRS') for the cdx, and
> > ADIR(onotherarray, '', 'D') for the subdirectories
> >
>
> Thanks for the idea Gregory,
> unfortunately the second command only returns current and parent
> directory ("." and "..") in FPW2.6 so instead I've modified it to include
> everything with no extension:
>
> ADIR(onotherarray, '*.', 'D') for the subdirectories
>
> It's not ideal since it will miss directories with an extension; it just
so
> happens that we don't have any of those where this runs. I should perhaps
> expand it to do 'AHRSD' since directories can be 'hidden', 'archive',
'read
> only' and maybe even 'system'. We'll see.. This program is run monthly by
> another user and every time he does it, it seems to go wrong for one
reason
> or another. Originally I had a long list of hardcoded directories that it
> processed one by one. It all went wrong when I swapped that for a routine
> that took one directory and recursed all subdirectories.
>
> --
> Thanks
> Andrew Howell
>
>


Re: FPW2.6a and ADIR by Andrew

Andrew
Wed Jun 30 06:04:14 CDT 2004

Gregory Adam wrote:
> Andrew,
>
> What I see over here is (vfp6)
>
> ? adir(xxx, 'c:\project\', 'D') && returns 2, ie . and ..
> but
> cd c:\project
> ? adir(xxx, '', 'D') returns 18 including . and ..
>
> Looks like you have to be in the directory for adir(xx, '', D') to
> work
>
> Maybe worth a try

Gregory,
you are right - well guessed! I never even told you I had
adir(xxx,m.dir,'D')

I'll just SET DEFAULT, drop the directory from ADIRs second parameter and
I'm away.

Thank you very much.

--
Regards
Andrew Howell



Re: FPW2.6a and ADIR by Anders

Anders
Thu Jul 01 06:45:26 CDT 2004

INSERT INTO myCursor FROM ARRAY thearray
No need to keep everthing stored in an array. VFP is pretty good a handling
data in tables.
Search the web for 'Treewalk'. FoxPro programs to handle this with recursion
have been around for years.
-Anders

"Andrew Howell" <ajh@work> wrote in message
news:#JeiGdnXEHA.2520@TK2MSFTNGP12.phx.gbl...
> Hello,
> I have a routine that processes tables with indexes. I did this by
using
>
> ADIR(thearray,'*.*','AHRSD')
>
> and then walking the array, searching for either a CDX file to process or
a
> subdirectory to recurse into.
> Unfortunately it trips up on larger directories with a memory error trying
> to execute the ADIR().
>
> I decided to take a listing of subdirectories and CDX files to make the
> resulting array much smaller. How can I do this though? At first I tried
>
> ADIR(thearray,'*.CDX','AHRSD')
>
> but that will only include directory names that match the file skeleton
(ie
> end in '.CDX'; which they don't.) Next I tried creating two arrays, one
for
> CDX files with ADIR(filearray,'*.CDX','AHRS) and one for subdirectories
with
> ADIR(dirarray,'*.*','D') but the latter matches all the files and
> directories which is prone to memory errors.
>
> Is it possible to get an array of all CDX files and all directories
without
> creating an array of everything and filtering it in Fox code?
> This is FPW2.6a.
>
> --
> TIA
> Andrew Howell
>
>
>


Re: FPW2.6a and ADIR by Andrew

Andrew
Thu Jul 01 09:25:55 CDT 2004

Anders Altberg wrote:
> INSERT INTO myCursor FROM ARRAY thearray
> No need to keep everthing stored in an array. VFP is pretty good a
> handling data in tables.

<g> yes, that is certainly an easier way of merging the two datasets which I
hadn't thought of. I still need to ADIR to an array first though, and that
is the bit that is susceptible to errors.

> Search the web for 'Treewalk'. FoxPro programs to handle this with
> recursion have been around for years.

This is a years old program that I wrote which is starting to go wrong when
running on directories with approximately 4000 files or more. The inbuilt
FILER application is also susceptible to these errors.

--
Best regards
Andrew Howell



Re: FPW2.6a and ADIR by Dan

Dan
Thu Jul 01 13:11:11 CDT 2004

MVCOUNT would do you no good at all. Arrays are a single memory variable.

Dan

Andrew Howell wrote:
> Andrew Howell wrote:
>> Hello,
>> I have a routine that processes tables with indexes. I did this
>> by using
>>
>> ADIR(thearray,'*.*','AHRSD')
>>
>> and then walking the array, searching for either a CDX file to
>> process or a subdirectory to recurse into.
>> Unfortunately it trips up on larger directories with a memory error
>> trying to execute the ADIR().
>
> A quick thought I just had:
> would the memory errors disappear with
>
> MVCOUNT=65000
>
> (or similar) in the config.fpw ? At the moment there is no MVCOUNT in
> the config.fpw and the helpfile says it defaults to 256.
>
> Any ideas?



Re: FPW2.6a and ADIR by Andrew

Andrew
Fri Jul 02 03:57:44 CDT 2004

Dan Freeman wrote:
> MVCOUNT would do you no good at all. Arrays are a single memory
> variable.

Thanks for that, I thought it was completely the opposite [ie each element
counted as a memvar.] MVCOUNT is a little hazy in that it's a config.fpw
setting only; there is no system variable you can check in the IDE to see
what it actually is set to (but I suppose you can easily write a program to
test..)

--
Regards
Andrew Howell



Re: FPW2.6a and ADIR by Anders

Anders
Thu Jul 01 13:07:48 CDT 2004

I was thinking of Calvin Hsia's Treewalk. Calvin is head C developer for
FoxPro.
-Anders

"Andrew Howell" <ajh@work> wrote in message
news:#nqSWd3XEHA.1764@TK2MSFTNGP10.phx.gbl...
> Anders Altberg wrote:
> > INSERT INTO myCursor FROM ARRAY thearray
> > No need to keep everthing stored in an array. VFP is pretty good a
> > handling data in tables.
>
> <g> yes, that is certainly an easier way of merging the two datasets which
I
> hadn't thought of. I still need to ADIR to an array first though, and that
> is the bit that is susceptible to errors.
>
> > Search the web for 'Treewalk'. FoxPro programs to handle this with
> > recursion have been around for years.
>
> This is a years old program that I wrote which is starting to go wrong
when
> running on directories with approximately 4000 files or more. The inbuilt
> FILER application is also susceptible to these errors.
>
> --
> Best regards
> Andrew Howell
>
>


Re: FPW2.6a and ADIR by Bernhard

Bernhard
Fri Jul 02 05:22:24 CDT 2004

Hi Andrew

> there is no system variable you can check in the IDE to see
> what it actually is set to (but I suppose you can easily write a program to
> test..)
DISPLAY MEMO without any parameters shows in the first few lines this variable
count stuff.

Regards
Bernhard Sander