forked from robinrodricks/FluentFTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUploadManyFiles.vb
43 lines (36 loc) · 1.12 KB
/
UploadManyFiles.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 UploadFilesExample
Sub UploadFiles()
Using ftp = New FtpClient("127.0.0.1", "ftptest", "ftptest")
ftp.Connect()
' upload many files, skip if they already exist on server
ftp.UploadFiles({
"D:\Drivers\test\file0.exe",
"D:\Drivers\test\file1.exe",
"D:\Drivers\test\file2.exe",
"D:\Drivers\test\file3.exe",
"D:\Drivers\test\file4.exe"
}, "/public_html/temp/", FtpRemoteExists.Skip)
End Using
End Sub
Async Function UploadFilesAsync() As Task
Dim token = New CancellationToken()
Using ftp = New FtpClient("127.0.0.1", "ftptest", "ftptest")
Await ftp.ConnectAsync(token)
' upload many files, skip if they already exist on server
Await ftp.UploadFilesAsync({
"D:\Drivers\test\file0.exe",
"D:\Drivers\test\file1.exe",
"D:\Drivers\test\file2.exe",
"D:\Drivers\test\file3.exe",
"D:\Drivers\test\file4.exe"
}, "/public_html/temp/", FtpRemoteExists.Skip)
End Using
End Function
End Module
End Namespace