Hello,
can anyone help me, what would be the problem: there's a procedure (Delphi, XE2) based on a demo, to read a remote directory from a server. When it runs first time, it reads succesfully. But any other occasions, after SFTP.OpenDirectory() gave back a handle, the SFTP client's EOF remains TRUE, so SFTP.ReadDirectory(Hdl) inside of the while-cycle won't be executed. I don't understand why.
(this procedure worked well with the 60 days trial version)
Has anyone any idea?
thanks,
Gábor
//------------------------------
procedure TForm1.ReadDir;
var n,i:integer;
Hdl:tScSFTPFileHandle; apUPLMAP:String;
begin
Hdl := SFTP.OpenDirectory(apUPLMAP);
try
while not SFTP.EOF do begin
SFTP.ReadDirectory(Hdl);
end;
finally
SFTP.CloseHandle(Hdl);
end;
end;
//---------------------------
sftp ReadDirectory
Re: sftp ReadDirectory
To solve your task, you should use the following code:
вместо
Code: Select all
repeat
SFTP.ReadDirectory(Hdl);
until SFTP.EOF;
Code: Select all
while not SFTP.EOF do begin
SFTP.ReadDirectory(Hdl);
end;
Re: sftp ReadDirectory
This question has cancelled, Viktor (Devart Team) solved it very soon.
Here we should use a repeat-until-cycle instead of a while-cycle.
That's all.
Thanks to him!
Here we should use a repeat-until-cycle instead of a while-cycle.
That's all.
Thanks to him!
Re: sftp ReadDirectory
It is good to see that the problem has been solved.
Feel free to contact us if you have any further questions about our products.
Feel free to contact us if you have any further questions about our products.