This project is read-only.

How to know the size of files?

Dec 28, 2011 at 3:01 AM


I'm using the Alex FTPS Client in a C# Application, and i want to list the files from a FTP Server knowing it's size (in bytes).

Is there any way to do it?


I'm doing as follows:

FTPSClient ftpClient = new FTPSClient();
                new NetworkCredential(FTPUser, FTPPass),

foreach (DirectoryListItem file in lista)
                        if (!file.IsDirectory && !file.IsSymLink)                        
                            // How to know the file size?

Dec 28, 2011 at 3:04 PM


you can use the GetFileTransferSize(fileName) method.




Jan 2, 2012 at 11:22 PM


DirectoryListItem now contains a "Size" attribute with the info obtained during the directory listing, I just committed the update.

Let me know if you need a compiled dll.






Feb 26, 2012 at 9:59 PM

That's great Alessandro, thanks!

- Daniel

Feb 26, 2012 at 10:36 PM

By the way, would be nice if you commit the last changes and release a new version of the compiled DLL. The project already have a lot of improvements!

Best regards,


Jun 7, 2012 at 2:57 PM

Is there any way to get the size of a directory using the library? I'm also developing a C# application and could use this functionality. I wrote a method that recursively navigates a directory and adds all the file sizes up, but it doesn't play nice with certain servers and the connection gets closed.


Many thanks

Apr 18, 2013 at 7:24 PM
A new DLL would be very helpful. I just started writing an app and got around to using DirectoryListItem and found out that 1.1.0 doesn't include the Size property so I'm kinda stalled right now.
Jul 25, 2013 at 12:11 PM

I'm also very interested by the "Size" attribute from the DirectoryListItem.

Can you tell me when a compiled dll will be available?