Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pysftp
- import os
- cnopts = pysftp.CnOpts()
- cnopts.hostkeys = None
- host = 'somehost'
- port = 22
- user = 'someuser'
- password ='samplepass'
- with pysftp.Connection(
- host=host,
- port=port,
- username=user,
- password=password,
- cnopts=cnopts
- ) as sftp:
- sftp_client = sftp
- path = 'root_folder'
- file_list_attr = sftp.listdir_attr(remotepath=path)
- file_stat = sftp.stat(os.path.join(path, 'file.txt'))
Add Comment
Please, Sign In to add comment