How to copy a file in a remote server /maindir/fil1.txt
to a sub directory /maindir/subdir/file1.txt
. I have the SFTP implemented using paramiko
. But it always check for the local path to copy from .
filename_full_path='/maindir/fil1.txt'
destfilename_full_path='/maindir/subdir/file1.txt'
sftp.put(filename_full_path, destfilename_full_path)
How to tell SFTP that the local path is also in remote host?
You can try in the below way
a=paramiko.SSHClient()
a.set_missing_host_key_policy(paramiko.AutoAddPolicy())
a.connect('ip',username='user',password='passw')
stdin, stdout, stderr = a.exec_command("cp /sourc/file /target/file")