Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Filer.dll wont show .userSettings.ini file
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
00992966
Message ID:
00993038
Vues:
111
This message has been marked as a message which has helped to the initial question of the thread.
>
>>ADIR() ?
>
>Wanted recursion, hidden, system and directories into the list, in short the whole lot and types of files and folders

Take a look at my _cdir function below
? _CDIR("crsDirs", "C:\", "*.*", "SUBDIR", "DHS")
...
FUNCTION _cdir
* Param's....: 1 - Cursor Name (R)
* 	 : 2 - Directory
* 	 : 3 - File search skeleton.
* 	 :     Multiple skeletons can be sepaarted by ';' (semicolon) or ',' (comma)
* 	 :     Can also be 1-d array with file skeletons
* 	 : 4 - Options: SUBDIR - recursively scan all subdirectories
* 	 :
* 	 : 5 - File attributes. Passed to ADIR as cAttribute parameter
* 	 : 6 - Flags. Passed to ADIR as nFlag parameter
* Return.....:
* Changes....:
*
LPARAMETERS tcCursorName, tcPath, tvPattern, tcOpt, tcAttributes, tnFlag
LOCAL lcCursorName, laPattern[1], lcAttributes, lnFlag, ;
      lcPath, laPattern, lcOpt, llRecursive, i, llBasicData

EXTERNAL ARRAY tvPattern
lcCursorName = UPPER(ALLTRIM(tcCursorName))
lcPath =ADDBS(UPPER(ALLTRIM(tcPath)))
IF EMPTY(lcPath)
	lcPath = FULLPATH("")
ENDIF	
DO CASE
CASE TYPE([ALEN(tvPattern)]) = "N"
	= ACOPY(tvPattern, laPattern)
CASE ";" $ tvPattern
	= ALINES(laPattern, UPPER(tvPattern), .T., ";")
CASE "," $ tvPattern
	= ALINES(laPattern, UPPER(tvPattern), .T., ",")
OTHERWISE
	laPattern[1] = UPPER(tvPattern)
ENDCASE
FOR i=1 TO ALEN(laPattern)
	laPattern[i] = UPPER(laPattern[i])
ENDFOR
lcAttributes = IIF( Empty( tcAttributes) Or VarType(tcAttributes) <> "C", "", ;
	UPPER(ALLTRIM(tcAttributes)))
lnFlag = IIF( Empty( tnFlag) Or VarType(tnFlag) <> "N", 0, tnFlag)
lcOpt = IIF( Empty( tcOpt) Or VarType(tcOpt) <> "C", "", ;
	UPPER(ALLTRIM(tcOpt)))
llRecursive = ("SUBDIR" $ lcOpt)
llBasicData = ("BASIC"  $ lcOpt)
IF llBasicData
	CREATE CURSOR (lcCursorName) ( ;
		Path C(60), FileName C(64), FileSize N(10), ;
		FileDate D, FileTime C(8), FileAttr C(5))
ELSE
	CREATE CURSOR (lcCursorName) ( ;
		Path C(60), FileName C(64), FileSize N(10), ;
		FileDate D, FileTime C(8), FileAttr C(5), ;
		FileExt C(5), ProcCode C(3), ProcDate D, ;
		ProcTime C(8), Note M)
ENDIF
INDEX ON path + FileName TAG pfn

= LoadOneDir(lcCursorName, lcPath , @laPattern, lcAttributes, lnFlag, lcOpt, llRecursive)

RETURN RECCOUNT(lcCursorName)
*----------------------------------------------------------------------------
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 == "." OR 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
ENDFUNC
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform