I am new to pysftp I am trying to do the following task
- Connect to ftp server and download the files
- Generate md5 checksum on files and making sure they are not tampered with
Can someone help me with this script?
I tried connecting to the server but I am unsure how to go about downloading the files and generating a checksum for the files on the downloaded files using python.
As of now I have connected to the server with the below code: *
import pysftp
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
myHostname = "abc.org"
myUsername = "username"
myPassword = "password"
with pysftp.Connection(host=myHostname, username=myUsername, password=myPassword, cnopts=cnopts) as sftp:
print ("Connection succesfully stablished ... ")
directory_structure = sftp.listdir_attr()
for attr in directory_structure:
print (attr.filename, attr)
**