Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Circumventing the ''Variable Not Found.'' error
Message
From
17/10/2000 23:43:41
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
 
To
17/10/2000 16:10:43
Josh Fedke
National Financial Corporation
Milwaukee, Wisconsin, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00430548
Message ID:
00430725
Views:
9
Hi Josh,
Why not just use ADIR() recursively?
Worm example by Charlie Schreiner
FileName  = "FileList"
CREATE TABLE (m.FileName) (FileName M, Path M, DateTime T, Size N(9))
CurPath = "C:\Common\"
RequerySys(m.CurPath)

*****************************************
PROCEDURE RequerySys(CurPath)
LOCAL FileSkeleton, Attributes, x
LOCAL ARRAY aFiles[1]

IF VARTYPE(m.CurPath) = "C" AND NOT EMPTY(m.CurPath)
ELSE
   CurPath = CURDIR()
ENDIF
CurPath = ADDBS(m.CurPath)

aFiles = NULL
FileSkeleton = "*.*"
Attributes = "DHS"

ADIR(aFiles, m.CurPath + m.FileSkeleton, m.Attributes)
FOR x = 1 TO ALEN(aFiles,1)
   INSERT INTO (DBF()) (FileName, Path, Size) ;
     VALUES (JUSTFNAME(aFiles[m.x,1]), m.CurPath, ;
      aFiles[m.x,2])
   IF "D" $ aFiles[m.x,5] AND NOT aFiles[m.x,1] = "."
      * It's a folder
      RequerySys(m.CurPath + aFiles[m.x,1])
   ENDIF
ENDFOR
RETURN
Notice that RequerySys() gets called recursively. Notice the LOCAL ARRAY aFiles declaration.
Hope this helps.

>I'm trying to make an adir() that is recursive. Foxpro's adir() does this awesome thing where it creates an array for the first parameter, if you didn't do it yourself. Since I would like to mimick the functionality of Adir(), I would like to do a similar thing. I'm getting the error one would expect, though, "Variable ... Not Found". Can I get around this to mimick Adir()'s functionality? Thanks in advance.
>
> -Josh
Charlie
Previous
Reply
Map
View

Click here to load this message in the networking platform