you can verify ur file completely downloaded by checking downloaded file size with ftp file size
for getting ftp file size use below function
public static long FileSize(string FTPFullFileName, string UserName, string Password)
{
try
{
FtpWebRequest FTP = (FtpWebRequest)FtpWebRequest.Create(FTPFullFileName);
FTP.Method = WebRequestMethods.Ftp.GetFileSize;
FTP.UseBinary = true;
FTP.Credentials = new NetworkCredential(UserName, Password);
FtpWebResponse Response = (FtpWebResponse)FTP.GetResponse();
Stream FtpStream = Response.GetResponseStream();
long FileSize = Response.ContentLength;
FtpStream.Close();
Response.Close();
return FileSize;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
calling above function
string ftpFileSize =Convert.ToString(FileSize(FTPFullFileName, UserName, Password)) ;
fetching downloaded file size using fileinfo
string localFileSize=string.Empty;
FileInfo info = new FileInfo("downloaded file path+filename");
if (info.Exists)
{
localFileSize = info.Length.ToString();
}
if localFileSize equals ftpFileSize ,ur download is complete
u have to make sure localFileSize & ftpFileSize are in same units else convert them to same unit
gud luck ;-)