-1

I have been unsuccessful in finding a way to read a file from a remote server over ssh and then writing a similar file in the same way. Paramiko doesn't seem to work with 3.5 and i'm not sure what else i can do.

Example of what i'm trying to do:

from shutil import copyfile
copyfile('10.1.1.5:v3/ec/s//01_inventory.txt', '10.1.1.5:v3/ec/s//01_inventory_Bkup.txt')
M4dW0r1d
  • 97
  • 3
  • 12

1 Answers1

0

You could use scp I suppose (https://ss64.com/bash/scp.html). You would have something like this to replace your copyfile call:

import subprocess

subprocess.call("scp 10.1.1.5:v3/ec/s/01_inventory.txt 10.1.1.5:v3/ec/s/01_inventory_Bkup.txt", shell=True)

You could also use scp to copy to your local host, modify it as you would normally and then replace the original.

Outis
  • 150
  • 7