FTP - GetFile, Can I prevent GetFileLength before ?

0 votes
asked Jan 11, 2013 by christophe (180 points)
edited Jan 14, 2013

Hi,

When I use Ftp.GetFile() method, it looks like the method first invokes GetFileLength to know the remote file length.

In my case, GetFileLength fails because LIST is not allowed on the server, and I can feed the remote size because I know it. So everytime I donwload, I got a Permission Denied on server size and a wasteful network call.

Is there a way to prevent GetFileLength call when calling GetFile ?

Regards,

Applies to: Rebex FTP/SSL

1 Answer

+1 vote
answered Jan 11, 2013 by Lukas Matyska (47,950 points)
edited Jan 14, 2013
 
Best answer

I suppose that you mean SIZE instead of LIST command is not allowed on your server.

Anyway, the SIZE command is send automatically only if you registered the TransferProgressChanged event (and TransferType is Binary).

If you want to still be informed about progress you can set the Ftp.Settings.DisableProgressPercentage to true. This will cause that the SIZE command is not sent to the server, progress event is raised, but item length is set to -1 and progress percentage is 0 for whole transfer.

commented Jan 11, 2013 by christophe (180 points)
edited Jan 14, 2013

Thank you for this quick answer !

I mean LIST because I use FileZilla server and the associated right is LIST. But the command is SIZE, you are right. I guess that not giving the right LIST prevent the command SIZE in FileZilla Server.

I'll check the Ftp.Settings.DisableProgressPercentage property in a couple of weeks, not before, and I'll let you know if it resolves my problem.

Regards,

commented Jan 14, 2013 by christophe (180 points)
edited Jan 14, 2013

Hi,

Setting Ftp.Settings.DisableProgressPercentage to true solves my problem.

Thank you again,

Regards,

Christophe

...