Archived Forum Post

Index of archived forum posts

Question:

Using listPattern to filter files

Oct 22 '12 at 09:09

Hi

I am trying to do this:

m_ftp.put_ListPattern(_T("*.accdb;*.mdb"));

But it won't work.

I can do:

m_ftp.put_ListPattern(_T("*.accdb"));
m_ftp.put_ListPattern(_T("*.mdb"));

But I really want all the files.

How should I set this? Thanks.

Andrew


Answer

I guess the ftp component just doesn't support multiple wildcards. Also, I just read this and it seems to me it is better to leave listPattern at its default value of "*": http://www.cknotes.com/?p=427

And then do the pattern-matching yourself, for example by using http://msdn.microsoft.com/en-us/library/windows/desktop/bb773727%28v=vs.85%29.aspx


Answer

The ListPattern is what is passed to the FTP server in the "LIST" command. (See the FTP protocol RFC 959 at http://www.ietf.org/rfc/rfc959.txt )

FTP servers allow for wildcards in the LIST parameter, but nothing more complicated than a single wildcarded pattern using one more more asterisk characters, such as "*.txt". It's not possible to set ListPattern to something like "*.accdb;*.mdb" because the FTP server wouldn't know what to do with it. In addition, even if Chilkat parsed this out into several LIST commands to be sent separately, each LIST command is essentially a data transfer where the directory listing is returned on a separate data channel. It wouldn't be a simple internal code modification because Chilkat would need to send multiple LIST commands, collect the data from each, and merge the listings to eliminate duplicates.