How do you use Paramiko to transfer complete directories? I\'m trying to use:
sftp.put(\"/Folder1\",\"/Folder2\")
which is giving me this e
As far as I know, Paramiko does not support recursive file upload. However, I have found a solution for recursive upload using Paramiko here. Follows an excerpt of their recursive upload function:
def _send_recursive(self, files):
for base in files:
lastdir = base
for root, dirs, fls in os.walk(base):
# pop back out to the next dir in the walk
while lastdir != os.path.commonprefix([lastdir, root]):
self._send_popd()
lastdir = os.path.split(lastdir)[0]
self._send_pushd(root)
lastdir = root
self._send_files([os.path.join(root, f) for f in fls])
You may try to either use their function SCPClient.put invoking the above function for recursive upload or implement it on your own.