Winscp
Winscp
==WinSCP automation with powershell== Powershell can be used to automate the upload and download of files from sftp servers using the .NET assembly
Setup Session:
Setup the SFTP session using the following code, you will need to have the winscp automation package stored on the server somewhere:
| |
Once you have the session options configured you can connect to the SFTP server using the following command:
| |
Get details of files on server
Use the enumerateremotefiles method to get the details of the files on the sftp server
| |
Upload Files
You can upload files using the PutFiles method:
| |
the parameters are as follows: local path to files to upload, destination directory on sftp server, remove files from source on successful transfer, transfer options
Download files
files can be downloaded using the GetFiles method:
| |