Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subscript out of defined range error
Message
From
18/03/2005 14:45:22
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Subscript out of defined range error
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00997398
Message ID:
00997398
Views:
43
Hello,
I am trying to perform a recursive file search, and I have gotten to the point where I am listing all of the directories. However, I keep getting a "Subscript out of defined range" error, and I can't figure out why. Can somebody take a look and give me some advice? Thanks!
CREATE CURSOR FILELIST ;
(filedir c(254), filename c(254), filedate D)


ReadFolder("FILELIST", "C:\", "*.*")

*******************************************************************
PROCEDURE ReadFolder
LPARAMETERS tcCursorName, tcPath, tcPattern
LOCAL lcCursorName, lcPath, lcPattern

lcCursorName = UPPER(tcCursorName)
lcPath = UPPER(tcPath)
lcPattern = UPPER(tcPattern)

lnCount = ADIR(DIRS,lcPath + "*.*" ,"D")

FOR x = 1 TO lnCount
**Error occuring on next line
	IF UPPER(SUBSTR(DIRS(x,5),5,1)) = "D" AND (ALLTRIM(DIRS(x,1)) <> "..") AND (ALLTRIM(DIRS(x,1)) <> ".")

   		ReadFolder(lcCursorName, lcPath + DIRS(x,1) + "\", lcPattern)
   	
   	ENDIF
   	
ENDFOR

RETURN
Very fitting: http://xkcd.com/386/
Next
Reply
Map
View

Click here to load this message in the networking platform