This is an old revision of the document!
WinSCP .NET Assembly Examples
Illustrative Examples
| Example | Description | Languages |
|---|---|---|
| Overall example | Create a session, upload a file and check/print results. | C#, VB.NET, PowerShell, JScript, VBScript, VBA, Perl, SSIS |
| Session.GetFiles, Session.FileExists and Session.GetFileInfo methods example | Check remote file existence, read remote file modification (last write) timestamp, conditionally download file. | C#, VB.NET, PowerShell, JScript, VBScript |
| Session.ListDirectory method example | Retrieve and print contents of remote directory. | C#, VB.NET, PowerShell, JScript, VBScript |
| Session.SynchronizeDirectories method and Session.FileTransferred event example | Synchronize local and remote directories, handle Session.FileTransferred event to display synchronization progress. |
C#, VB.NET, PowerShell |
| Session.ExecuteCommand method example | Execute a command on a remote side, download results. | C#, VB.NET, PowerShell |
| Session.FileTransferProgress event example | Display progress of file transfer. | C#, VB.NET, PowerShell |
Real-Life Examples
| Example | Languages |
|---|---|
| Downloading file to timestamped-filename | PowerShell |
| Downloading the most recent file | PowerShell |
| Moving local files to different location after successful upload | PowerShell |
| Deleting remote files after successful remote to local synchronization | PowerShell |
| Listing files matching wildcard | PowerShell |
| Locking files while uploading / Upload to temporary file name | PowerShell |
Advertisement