We have recently been involved in one of the automations where we must upload the csv file automatically daily to vendor Secure FTP.
This time we have utilized Python instead of PowerShell because of project requirements.
I am sharing the code samples here to achieve it.
Module required:
Download the code samples from git hub
https://github.com/VikasSukhija/Python
First Sample à fetchhostkeyssftp
This script sample will assist you in fetching the host keys from spftp and save it in designated folder.
This is required many a times by secureftp to avoid man in the middle attacks.
Another code sample is Upload2Sftp:
This script will upload the csv file from local path to remote path.
As in the above screenshot you can see local path is D:\temp\vendor.csv and it will upload to root/import/vendor.csv on sftp server.
Note: These are code samples only and not the whole script.
Thanks for reading ….
Tech Wizard