forked from robinrodricks/FluentFTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DownloadManyFiles.vb
43 lines (36 loc) · 1.15 KB
/
DownloadManyFiles.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Imports System
Imports System.Net
Imports System.Threading
Imports System.Threading.Tasks
Imports FluentFTP
Namespace Examples
Friend Module DownloadFilesExample
Sub DownloadFiles()
Using ftp = New FtpClient("127.0.0.1", "ftptest", "ftptest")
ftp.Connect()
' download many files, skip if they already exist on disk
ftp.DownloadFiles("D:\Drivers\test\", {
"/public_html/temp/file0.exe",
"/public_html/temp/file1.exe",
"/public_html/temp/file2.exe",
"/public_html/temp/file3.exe",
"/public_html/temp/file4.exe"
}, FtpLocalExists.Skip)
End Using
End Sub
Async Function DownloadFilesAsync() As Task
Dim token = New CancellationToken()
Using ftp = New FtpClient("127.0.0.1", "ftptest", "ftptest")
Await ftp.ConnectAsync(token)
' download many files, skip if they already exist on disk
Await ftp.DownloadFilesAsync("D:\Drivers\test\", {
"/public_html/temp/file0.exe",
"/public_html/temp/file1.exe",
"/public_html/temp/file2.exe",
"/public_html/temp/file3.exe",
"/public_html/temp/file4.exe"
}, FtpLocalExists.Skip)
End Using
End Function
End Module
End Namespace