Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pysftp
- import pandas as pd
- host = r'sftp.conexussolutionsinc.com'
- username = r'01ASkaiser'
- password = r'K@!ser3007$bdu'
- cnopts = pysftp.CnOpts()
- cnopts.hostkeys = None # disable host key checking.
- df_list = []
- with pysftp.Connection(host, username=username, password=password, cnopts=cnopts) as sftp:
- sftp.chdir(r'/From_Aclaris')
- #print sftp.pwd
- # Filedir = list of every file in the /From_Aclaris/ folder; consider replacing manually so you can
- # add on the date at end
- filedir = sftp.listdir()
- filedir = []
- filedir.append('')
- filedir.append('')
- filedir.append('')
- #print filedir
- localdir = r"C:/Users/GerardoZampaglione/Desktop/temp/"
- for filename in filedir:
- l_path = localdir + filename
- sftp.get(remotepath = filename, localpath=l_path, preserve_mtime=True)
- #l_path is the item that gets you to each filename
- df_list.append(pd.read_table(l_path))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement