Differences
This shows you the differences between the selected revisions of the page.
| 2021-03-05 | 2021-04-08 | ||
| vb.net snippet (martin) | simplify with GetFileToDirectory (martin) | ||
| Line 8: | Line 8: | ||
| <code powershell> | <code powershell> | ||
| param ( | param ( | ||
| - | $localPath = "c:\downloaded\", | + | $localPath = "c:\downloaded", | 
| - | $remotePath = "/home/user/" | + | $remotePath = "/home/user" | 
| ) | ) | ||
| Line 51: | Line 51: | ||
| # Download the selected file | # Download the selected file | ||
| - | $session.GetFiles( | + | $session.GetFileToDirectory($latest.FullName, $localPath) | Out-Null | 
| - | [WinSCP.RemotePath]::EscapeFileMask($latest.FullName), $localPath).Check() | + | |
| } | } | ||
| finally | finally | ||
| Line 97: | Line 96: | ||
| session.Open(sessionOptions); | session.Open(sessionOptions); | ||
| - | const string remotePath = "/home/user/"; | + | const string remotePath = "/home/user"; | 
| - | const string localPath = @"C:\downloaded\"; | + | const string localPath = @"C:\downloaded"; | 
| // Get list of files in the directory | // Get list of files in the directory | ||
| Line 117: | Line 116: | ||
| // Download the selected file | // Download the selected file | ||
| - | session.GetFiles( | + | session.GetFileToDirectory(latest.FullName, localPath); | 
| - | RemotePath.EscapeFileMask(latest.FullName), localPath).Check(); | + | |
| } | } | ||