Files Transfer

from netmiko import ConnectHandler, file_transfer

source_file = “file.ext”
dest_file = “file.ext”
direction = “put”   /  “get”
file_system = “bootflash:”

# Create the Netmiko SSH connection
ssh_conn = ConnectHandler(**devices)
transfer_dict = file_transfer(

ssh_conn,
source_file=source_file,
dest_file=dest_file,
file_system=file_system,
direction=direction,
overwrite_file=True,
)
print(transfer_dict)

 

Reference :
Python for Network Engineers

Leave a Comment