How to handle FTP ChangeDir delay?
This is not really an Indy problem but I'm stuck. I am having a major
problem handling the delay between changing a directory on the (Linux)
server and getting the correct DirectoryListing. I log into the root and
execute the following code:
WriteLog(GetNow + 'ChangeDir(' + aDir + ')');
ChangeDir(aDir);
WriteLog(GetNow +
IntToStr(LastCmdResult.NumericCode) + ' ' + LastCmdResult.Text.Text);
ServerFiles := TStringList.Create;
WriteLog(GetNow + 'List');
List(ServerFiles, '*.*', true);
WriteLog(GetNow +
IntToStr(LastCmdResult.NumericCode) + ' ' + LastCmdResult.Text.Text);
FreeAndNil(ServerFiles);
for i := 0 to DirectoryListing.Count - 1 do
WriteLog(DirectoryListing[i].Data);
WriteLog('DirectoryListing.Count: ' + IntToStr(DirectoryListing.Count));
The log file shows that while the directory change has been succesful (250
CWD command successful) the DirectoryListing is of the root directory!
Exactly the same thing happens when I subsequently change the directory to
aDir+'/images', the subsequent DirectoryListing is of aDir. I thought of
putting in a pause of a second or so but that's no guarantee that the server
has actually caught up. How can I handle this?
--
Quidquid latine dictum sit, altum videtur.