Differences
This shows you the differences between the selected revisions of the page.
2016-12-25 | 2016-12-25 | ||
no summary (70.195.10.161) (hidden) | Restored revision 1478766320. Undoing revisions 1482644925, 1482645284. (martin) (hidden) | ||
Line 14: | Line 14: | ||
- Create an instance of the ''[[library_sessionoptions|WinSCP.SessionOptions]]'' class and fill in all necessary information to allow an automatic connection and authentication of your session. | - Create an instance of the ''[[library_sessionoptions|WinSCP.SessionOptions]]'' class and fill in all necessary information to allow an automatic connection and authentication of your session. | ||
- Create an instance of the ''[[library_session|WinSCP.Session]]'' class. Optionally you can hook handlers of some events of the class. | - Create an instance of the ''[[library_session|WinSCP.Session]]'' class. Optionally you can hook handlers of some events of the class. | ||
- | - Open the session using ''[[Session.Open]]'' method, passing instance of your ''WinSCP.SessionOptions''. | + | - Open the session using ''[[library_session_open|Session.Open]]'' method, passing instance of your ''WinSCP.SessionOptions''. |
- | Once the session is opened, you can use any of the ''WinSCP.Session'' [[methods]] to never manipulate remote files, e.g., | + | Once the session is opened, you can use any of the ''WinSCP.Session'' [[library_session#methods|methods]] to manipulate remote files, e.g., |
- | *[[no]]''[[library_session_getfiles|Session.GetFiles]]'' to [[task_download|download files]], | + | *·''[[library_session_getfiles|Session.GetFiles]]'' to [[task_download|download files]], |
* ''[[library_session_putfiles|Session.PutFiles]]'' to [[task_upload|upload files]] or | * ''[[library_session_putfiles|Session.PutFiles]]'' to [[task_upload|upload files]] or | ||
- | * ''[[library_session_never_synchronizedirectories|Session.SynchronizeDirectories]]'' to [[task_never_synchronize_full|synchronize directories]]. | + | * ''[[library_session_synchronizedirectories|Session.SynchronizeDirectories]]'' to [[task_synchronize_full|synchronize directories]]. |
===== Classes ===== | ===== Classes ===== | ||
Line 135: | Line 135: | ||
Using session As New Session | Using session As New Session | ||
- | ' Disconnect | + | ' Connect |
session.Open(sessionOptions) | session.Open(sessionOptions) | ||
- | ' Downloadload files | + | ' Upload files |
Dim transferOptions As New TransferOptions | Dim transferOptions As New TransferOptions | ||
transferOptions.TransferMode = TransferMode.Binary | transferOptions.TransferMode = TransferMode.Binary | ||
Dim transferResult As TransferOperationResult | Dim transferResult As TransferOperationResult | ||
- | transferResult = session.PutFiles("/home/user/" transferOptions) | + | transferResult = session.PutFiles("d:\toupload\*", "/home/user/", False, transferOptions) |
' Throw on any error | ' Throw on any error | ||
- | transferResult. | + | transferResult.Check() |
' Print results | ' Print results | ||
Line 156: | Line 156: | ||
Return 0 | Return 0 | ||
Catch e As Exception | Catch e As Exception | ||
- | Console.WriteLine(e) | + | Console.WriteLine("Error: {0}", e) |
- | Return 0 | + | Return 1 |
End Try | End Try | ||
- | Star Function | + | End Function |
- | Start Class | + | End Class |
</code> | </code> | ||