I'm sure this is a stupid mistake, but I'm stuck here.
First I use client.size() to get the file size.
Then I use client.get() to download the file
The get command ends at 52.46 or 52.47% of the reported file size.
This percentage is consistent between different sized files!
Here is the code:
Private WithEvents client As FTPClient
Private size As Long
Sub Main()
client = New FTPClient
client.RemoteHost = "none.ofyourbusiness.com"
client.ControlPort = 21
client.Connect()
client.Login("user", "password")
size = client.Size("/usr/home/photo_album.tar.bz2")
client.Get("c:\WEBSITE_BACKUPS\photo_album.tar.bz2", "/usr/home/photo_album.tar.bz2")
Console.WriteLine("Transfer complete")
Console.ReadLine()
End Sub
Private Sub client_BytesTransferred(ByVal sender As Object, ByVal e As EnterpriseDT.Net.Ftp.BytesTransferredEventArgs) _
Handles client.BytesTransferred
Console.Clear()
Console.WriteLine(((e.ByteCount / size) * 100).ToString("N2") & vbCrLf & _
e.ByteCount.ToString("N0") & " / " & size.ToString("N0") & vbCrLf)
End Sub
Output:
>52.46
>2,275,054 / 4,337,124
>
>Transfer Complete
Any ideas as to what I'm doing wrong here???