*) Program...........: CDIR.PRG * Author............: Daniel Gramunt * Created...........: 22.04.2004 - 15:50:44 (Visual FoxPro 07.00.0000.9465) * Copyright.........: (c) Nokia, 2004 *) Description.......: Creates a cursor with files that match the specified *) : file pattern. For performance reasons, we currently *) : only return the filename. Could be enhanced to *) : return other info if required, though it would be *) : rather expensive in terms of performance. *) : This method can be used to work around the array *) : limitation of ADIR() when processing folders with *) : more than 13K files. *) : * Calling Samples...: * Parameter List....: * Major change list.: *-------------------------------------------------------------------------------------------------- LPARAMETERS tcFolder, tcFilePattern, tcCursor ASSERT VARTYPE(tcFolder) = "C" AND DIRECTORY(tcFolder); MESSAGE "Parameter < tcFolder > : Parameter missing, wrong type or folder not found" ASSERT VARTYPE(tcFilePattern) = "C"; MESSAGE "Parameter < tcFilePattern > : Parameter missing or wrong type (Expecting 'C')" LOCAL lcFolder, lcFilePattern, lcCursor, lcOldDir, lcFileName, lnFileCount lcFolder = ADDBS(UPPER(ALLTRIM(tcFolder))) lcFilePattern = IIF(VARTYPE(tcFilePattern) = "C", tcFilePattern, "*.*") lcCursor = IIF(VARTYPE(tcCursor) = "C", tcCursor, "aFiles") lcOldDir = SYS(5) + SYS(2003) SET DEFAULT TO (lcFolder) CREATE CURSOR (lcCursor) (cJustPath C(254) , cJustFName C(254)) lcFileName = SYS(2000, lcFilePattern) lnFileCount = 0 DO WHILE NOT EMPTY(lcFileName) IF LIKE(lcFilePattern, lcFileName) lnFileCount = lnFileCount + 1 INSERT INTO (lcCursor) (cJustPath, cJustFName) VALUES(lcFolder, lcFileName) ENDIF lcFileName = SYS(2000, lcFilePattern, 1) ENDDO SET DEFAULT TO (lcOldDir) RETURN lnFileCount *-- EOF CDIR.PRG ---------------------------------------------------------------------------------->Hi guys,