Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Feb : Re: TidFTP no file size returned

www.cryer.info
Managed Newsgroup Archive

Re: TidFTP no file size returned

Subject:Re: TidFTP no file size returned
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Wed, 14 Feb 2007 10:21:26

"Michael Fritz" <spam_athome@yahoo.de> wrote in message
news:18g8aixbnvf1m$.igilojgtr6c7$.dlg@40tude.net...

>       i := FTP.Size(s);
>       if i = -1 then << always returns -1

Then the server does not support the SIZE command, or is sending back
a malformed reply to it.

> As Size(s) always returns -1 for a file(!) it tries to change the
> directory but throws an exceptions since this is not really a dir.

You should not be using Size() to differentiate between a file and a
directory.  That is a very poor design choice.  You need to use the
List() method with the DirectoryListing collection instead.  That will
give you detailed information about items, including whether they are
actually files or directories.

> Do I have to add a FTP parser as I've read in some threads here?

That has no effect on Size().  That only effects the DirectoryListing
collection.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive