|   | 
      
        
          
            
              | INT GetFileList( | 
             
            
              |   | 
              LPCTSTR lpszDirectory, | 
                | 
             
            
              |   | 
              DWORD dwOptions, | 
                | 
             
            
              |   | 
              LPTSTR lpszBuffer, | 
                | 
             
            
              |   | 
              INT nMaxLength | 
                | 
             
            
              | ); | 
             
           
         
        
          
            
              | INT GetFileList( | 
             
            
              |   | 
              LPCTSTR lpszDirectory, | 
                | 
             
            
              |   | 
              DWORD dwOptions, | 
                | 
             
            
              |   | 
              CString& strBuffer | 
                | 
             
            
              | ); | 
             
           
         
        
          The GetFileList method returns an unparsed list of files in the specified directory. 
         
        Parameters
        
          
            - lpszDirectory
 
            - A null-terminated string that specifies the name of 
            a directory and/or a wildcard file mask. The format of the directory 
            name must match the file naming conventions of the server. If this 
            parameter is NULL or points to an empty string, the current working 
            directory will be used.
 
            - dwOptions
 
            - An unsigned integer that specifies one or more options. This
            parameter may be any one of the following values:
 
           
         
        
          
            
              
                | Value | 
                Description | 
               
              
                | FTP_LIST_DEFAULT | 
                This option specifies the server should return a 
                complete listing of files in the specified directory with as 
                much detail as possible. This typically means that the file 
                size, date, ownership and access rights will be returned to the 
                client. Information about the files are returned in lines of 
                text, with each line terminated by carriage return and linefeed 
                (CRLF) characters. The exact format of the data returned is 
                specific to the server operating system. | 
               
              
                | FTP_LIST_NAMEONLY | 
                This option specifies the server should only return a 
                list of file names, with no additional information about the 
                file. Each file name is terminated by carriage return and 
                linefeed (CRLF) characters. | 
               
             
           
         
        
          
            - lpszBuffer
 
            - A null-terminated string buffer that will contain the list of files 
            when the function returns. This buffer should be large enough to 
            store the complete file listing and a terminating null character. If 
            the buffer is smaller than the total amount of data returned by the 
            server, the data will be truncated. This parameter cannot be NULL.
 
            - nMaxLength
 
            - An integer value that specifies the maximum number of characters 
            that can be copied into the string buffer, including the terminating 
            null character.
 
           
         
        Return Value
        
          If the function succeeds, the return value is the number of bytes 
          copied into the string buffer, not including the terminating null 
          character. If the function fails, the return value is FTP_ERROR. To get
          extended error information, call FtpGetLastError. 
         
        Remarks
        
          The GetFileList method returns a list of files in the 
          specified directory, copying the data to a string 
          buffer. Unlike the other methods like EnumFiles that parse 
          a directory listing and return information in an FTPFILESTATUS 
          structure, this method returns the unparsed file list data. The 
          actual format of the data that is returned depends on the operating 
          system and how the server implements file listings. For example, UNIX 
          servers typically return the output from the /bin/ls command. 
          Some servers may not support file listings for any directory other
          than the current working directory. If an error is returned when
          specifying a directory name, try changing the current working directory
          using the ChangeDirectory method and then call this
          method again, passing NULL or an empty string as the
          lpszDirectory parameter. 
          This method can be particularly useful when the client is 
          connected to a server that returns file listings in a format that is 
          not recognized by the library. The application can retrieve the 
          unparsed file listing from the server and parse the contents. Note 
          that if you specify the FTP_LIST_NAMEONLY option, the data will 
          only contain a list of file names and there will be no way for the 
          application to know if they represent a regular file or a 
          subdirectory. 
          This method is supported for both FTP and SFTP (SSH) connections, 
          however the format of the data may differ depending on which protocol 
          is used. Most UNIX based FTP servers will not list files and 
          subdirectories that begin with a period, however most SFTP servers 
          will return a list of all files, even those that begin with a period. 
          This function will cause the current thread to block until the file 
          listing completes, a timeout occurs or the operation is canceled. 
         
        Example
        
          
CString strFileList;
nResult = pClient->GetFileList(NULL, FTP_LIST_DEFAULT, strFileList);
if (nResult != FTP_ERROR)
    pEditCtl->SetWindowText(strFileList);
else
{
    pClient->ShowError();
    return;
}
         
        Requirements
        
          Minimum Desktop Platform: Windows 7 Service Pack 1 
          Minimum Server Platform: Windows Server 2008 R2 Service Pack 1 
          Header File: cstools11.h 
          Import Library: csftpv11.lib 
          Unicode: Implemented as Unicode and ANSI versions 
         
        See Also
        
          CloseDirectory, 
          EnumFiles,
          GetDirectoryFormat, 
          GetFirstFile,
          OpenDirectory, 
          GetNextFile 
         
       | 
        |