I'm using the MFC WinInet wrapper classes to make use of the API. So, my
code looks like the following:
CInternetSession inetSession;
CFtpConnection * pConnection = NULL;
pConnection =
inetSession.GetFtpConnection(oc->server,oc->userName,oc->password);
CFtpFileFind finder(pConnection);
CStringArray filesToDelete;
BOOL bWorking = finder.FindFile(oc->fileNames);
while (bWorking)
{
bWorking = finder.FindNextFile();
filesToDelete.Add(finder.GetFilePath());
}
What is the correct way to deal with this? I've tried using the following
as arguments to the FindFile() method which do not appear to work.
My?Stuff
My\ Stuff
My*Stuff
I've been able to work around the issue as follows. It turns out you can
change the working directory to a directory which contains spaces. So, I
pull off the directory portion of the string and change the working directory
to that directory. Once there, I use the find function on the file pattern.
For example, assuming the file pattern to remove looks like the below:
"/a/b/c/My Stuff/data*.exe"
I first change the working directory to "/a/b/c/My Stuff" and then use the
find on "data*.exe".
The limitation this workaround introduces is that the wildcards can only be
in the filename part not the directory path portion. So you can't do
"/a/b*/c/My Stuff/data*.exe", for example.