Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alternative for adir

Status
Not open for further replies.

SYN

Programmer
Nov 2, 2000
45
NL
Hello,

I'm looking for an alternative for ADIR() function in FOXPRO 2.5. ADIR() causes a failure when the number of files exceeds a few thousand. I get a 'Too many memory variabeles failure'

So, I'm looking for another method/function to get a compleet directory tree, preferably into a cursor.

Can anyone help me?

Thanks.
 
create table C:\FILESDBF.DBF (NAME c(40), SIZE n(10,0), DATE d, TIME c(8), ATTRIB c(4)

run Dir *.* > dir.txt
use dir2dbf
append from dir.txt sdf

This will not do everything you want but it will create 3 tables on C:\root. You can alter it to do what you want. But at least it is a starting point
Files Directry and drives
Files will be a list of all the files in the default directory
Directory will be all the subdirectories under the default
Drives will be all the drives available on your computer
David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
As long as speed isn't critical, you can set up a loop with SYS(2000). If you need details on the files, you can also do an ADIR() on each individual file and insert the info into a cursor. e.g.

lctempdir = "c:\" && Path I want to look at
lcdefdir = FULLPATH(SET("default")) && save off current
SET DEFAULT TO (lctempdir)
lcnext_file = SYS(2000, '*.*')
DO WHILE ! EMPTY(lcnext_file)
* ADIR(laFileInfo, lcnext_file)
* INSERT INTO mycursor FROM ARRAY laFileInfo
* ... whatever
lcnext_file = SYS(2000, '*.vcx', 1) && get next one
ENDDO

SET DEFAULT TO (lcdefdir) && restore current


Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top