-
-
Notifications
You must be signed in to change notification settings - Fork 11
FTP Download Example
Andrew Lambert edited this page Sep 26, 2023
·
15 revisions
This example performs a synchronous FTP download on the calling thread.
Dim c As New cURLClient
c.Username = "username"
c.Password = "seekrit"
Dim outputfile As FolderItem = SpecialFolder.Desktop.Child("file.zip")
Dim outputstream As BinaryStream = BinaryStream.Create(outputfile)
If Not c.Get("ftp://ftp.example.com/bin/file.zip", outputstream) Then
MsgBox(libcURL.FormatError(c.LastError))
End If
outputstream.Close()
This example uses the FTPWildCard class to download all zip files in the remote directory:
Dim outputdir As FolderItem = SelectFolder()
Dim w As New libcURL.FTPWildCard
w.LocalRoot = outputdir
Dim c As New cURLClient(w) ' pass the FTPWildCard to cURLSession.Constructor(EasyHandle)
c.Username = "username"
c.Password = "seekrit"
If Not c.Get("ftp://ftp.example.com/bin/*.zip") Then ' use a pattern in the URL
MsgBox(libcURL.FormatError(c.LastError))
End If
outputdir.Launch
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2014-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.