0

I work with Delphi 11.2 and Clever Internet Suite 10.2.
I have a program that copy some files on 2 different FTP servers.
However when I try to list files from ftp folders, one is functioning and the other no.

The same code function for the first FTP and give "450 File not available" for the second FTP.
the code used.

clFtpMain: TclFtp;

clFtpMain.Server         := 'storage.rcs-rds.ro';
clFtpMain.Port           := 21;
clFtpMain.Username       := 'username';
clFtpMain.Password       := 'pass';
clFtpMain.PassiveMode    := True;
clFtpMain.Timeout        := 10000;
clFtpMain.UseTLS := ctNone;
clFTPMain.Open;
clFTPMain.ChangeCurrentDir('/folder');
clFTPMain.DirectoryListing('*');   // <-- error here

any advice?

2 Answers 2

1

Some FTP servers are smart enough to send a 450 reply when there is nothing available to list. This saves having to waste resources creating a data channel that won't send anything.

Whereas some FTP servers will always open a data connection to send a listing, even an empty one.

Either way, a client needs to handle both cases, but it sounds like the client you are using is not treating the 450 case as a non-error. That would be a bug in that component. Contact its author for a fix, or use a different client that does not have that bug.

2
  • I'm 100% sure that is something on the server. I mean folders and files. Feb 5 at 18:41
  • @PopaOvidiu-Razvan whether or not the server replies with 450 on an empty listing, and whether or not the component raises an error on a 450 reply, are two completely different issues. If you feel the listing shouldn't be empty, but is being reported as empty, then you need to take that up with the server admin. Are you able to access the files/folders with a non-coding FTP client, like FileZilla? Feb 6 at 15:36
0

The solution that I find is not to put any filter on the DirectoryListing function.
Apparently enter any params there will result into an exception.
If you dont enter param the listing is ok and bring the files (if exist).

clFTPMain.DirectoryListing('');   // <-- working  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.