Using the System.Net.WebRequestMethods.FTP class, we can use the "SIZE" FTP Protocol method to get the size of the file in FTP. Below is an example in C#:
var request = (FtpWebRequest)FtpWebRequest.Create(ftpUrl);
request.Credentials = new NetworkCredential("username", "password");
request.KeepAlive = false;
//Use the GetFileSize FILE SIZE Protocol method
request.Method = WebRequestMethods.Ftp.GetFileSize;
request.UseBinary = true;
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
fileSize = response.ContentLength;
response.Close();
request.Abort();