Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adir() help
Message
From
08/03/2005 11:01:56
 
 
To
08/03/2005 10:39:30
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00909947
Message ID:
00993665
Views:
27
Maybe check if lnDir = 0, IOW, not files matched?

>Sergey,
>I am using your _CDIR function, but I keep getting an "Invalid Subscript Reference" on the following line of the LoadOneDir function :
>
>lnFiles = ADIR(laFileList, tcPath + "*.*", lcAttributes, tnFlag)
>
>It seems like laFileList is sent to .f., and I can't figure out why. Thanks Sergey!
>
>
>FUNCTION LoadOneDir(tcCursorName, tcPath, taPattern, tcAttributes, tnFlag, tcOpt, tlRecursive)
>EXTERNAL ARRAY taPattern
>
>LOCAL lnFiles, i, laFileList[1], x, lcExtraAttr, llInclude, lcFileName, llBasicData
>llBasicData = ("BASIC"  $ tcOpt)
>
>IF NOT tlRecursive  OR ("D" $ tcAttributes)
>	lcAttributes = tcAttributes
>ELSE
>	lcAttributes = tcAttributes + "D"
>ENDIF
>
>lnFiles = ADIR(laFileList, tcPath + "*.*", lcAttributes, tnFlag)
>=ASORT(laFileList)
>
>FOR i=1 TO lnFiles
>	lcFileName = laFileList[i,1]
>	IF lcFileName = "."
>		LOOP
>	ENDIF
>
>	IF NOT ("." $ lcFileName)
>		lcFileName = lcFileName + "."
>	ENDIF
>	llInclude = .F.
>	FOR x=1 TO ALEN(taPattern)
>		IF LIKE(taPattern[x], lcFileName)
>			llInclude = .T.
>			EXIT
>		ENDIF
>	ENDFOR
>
>	IF llInclude AND ( NOT ("D" $ laFileList[i,5]) OR ("D" $ tcAttributes) )
>			INSERT INTO (tcCursorName) ;
>				( Path, FileName, FileSize, FileDate, FileTime, FileAttr) ;
>				VALUES (UPPER(tcPath), laFileList[i,1], ;
>				laFileList[i,2], laFileList[i,3], ;
>				laFileList[i,4], laFileList[i,5])
>		IF NOT llBasicData
>			REPLACE FileExt WITH JUSTEXT(laFileList[i,1])
>		ENDIF		
>	ENDIF
>
>	IF tlRecursive AND ("D" $ laFileList[i,5])
>		*susp
>		= LoadOneDir(tcCursorName, ADDBS(ALLTRIM(tcPath) + ALLTRIM(laFileList[i,1])), ;
>			@taPattern, tcAttributes, tnFlag, tcOpt, tlRecursive)
>	ENDIF
>ENDFOR
>
>
>RETURN
>
>
Previous
Reply
Map
View

Click here to load this message in the networking platform