The problem with the above fragment is that folders.GetCount() is that
it will always return zero as there is no GetDirList outside of it -
also I have found that FTP commands generally only work on the current
remote directory i.e. you need to chdir first so for example to get a
count of all the files, (not directories), on the remote system you
could use something like:
int GetFileCount(wxString SubDir="/", wxString WCard="")
{
/* WARNING UNTESTED CODE Not sure it will even compile */
wxArrayString FileList;
wxArrayString DirList;
int FileCount = 0;
int n;
m_ftp.ChDir(SubDir); // Change the remote directory to the
sub-directory
m_ftp.GetFileList(&FileList, WCard); // Get the file list
FileCount = FileList.GetCount(); // Get the File count in the directory
for (n = 0; n < DirList.GetCount(); n++) // Handle the sub-directories
{
FileCount += GetFileCount(DirList[n], WCard); // Recursive call
}
m_ftp.ChDir("..") // Back to where we were IMPORTANT
return (FileCount) // Return the file count for the specified sub
directory
}
Hope that is some help. If it works ok you could use it as a template
for a function that would get all the files that match a given wildcard,
etc.
Gadget/Steve