Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio, asyncssh, sys
- import string
- from tqdm import tqdm
- from time import sleep
- import progressbar
- pbar = tqdm(unit='B', unit_scale=True, unit_divisor=1024,)
- def progress(srcpath, dstpath, bytes_copied, total_bytes):
- pbar.total = total_bytes
- pbar.update(bytes_copied)
- async def run_client():
- async with asyncssh.connect('=', username='', port= ) as conn:
- async with conn.start_sftp_client() as sftp:
- await sftp.mput('TFOLDER ', progress_handler = progress, recurse = True)
- try:
- asyncio.get_event_loop().run_until_complete(run_client())
- except (OSError, asyncssh.Error) as exc:
- sys.exit('SFTP operation failed: ' + str(exc))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement