NLST Method
Class: FTP_SERVICE
Expand/Collapse source code of procedure NLST Source Code
      LPARAMETERS OUTREF laDirectory, INP lcMask,OPT_INP lnFlag
      LOCAL cStruct, liResult, lnCount, fResult, lffHandle,lihFTP,liRead,lii,lcBuffer,lcData,liData
      IF This.OpenFTPConnection(This.cCurrentDir)     && Open an FTP Handle

         * Dimension the array to store the directory
         * [x, 1] = FileName
         * [x, 2] = Alternate FileName
         * [x, 3] = File Size
         * [x, 4] = File Create Date
         * [x, 5] = File Last Access Time
         * [x, 6] = File Last Write Time
         * [x, 7] = File Attributes
         DIMENSION laDirectory [1, 7]
         laDirectory [1, 1] = .F.

         fResult=IIF(This.FTPCommand("FEAT "+lcMask,FTP_TRANSFER_TYPE_ASCII,0,@lihFTP),1,0)
         IF fResult #0 && OK, FTP list is openned

            lii=0
            liData=500
            STORE 1 TO fResult,liRead
            lcData=""

            DO WHILE liRead>0
               liRead=0
               lcBuffer=SPACE(liData)
               fResult = InternetReadFile(lihFTP, @lcBuffer, liData, @liRead)
               =This.GetExtendedError()

               lcData=lcData+LEFT(lcBuffer,liRead)
               lii=lii+liRead
            ENDDO

            IF VAL(STRTRAN(SUBS(VERSION(),LEN("Visual FoxPro ")+1,2),"0",""))>=6
*               liCount=ALINES()
            ELSE
            ENDIF
*SUSPEND
            =STRTOFILE(lcData,"e:\nlst.txt")

            * fòuk, fnuk, I'm lazy : http://cr.yp.to/ftpparse/ftpparse.c
*         =This.AfterGetFTPDirectoryArray(@laDirectory, @lcMask, lnFlag,liResult)
         ENDIF
         =This.CloseFTPConnection()   && Close FTP Handle
      ELSE
         RETURN .F.     && Unable to get FTP Connection   
      ENDIF
      RETURN .T.