2

I am having difficulty understanding how to use the put method to transfer a directory recursively.

I am coming from using pysftp and using the put_r method.

I have a local path and a remote path and I am simply trying to upload the local path recursively into the remote path.

local_path: /test
remote_path: /backups

I have tried:

c.put(local_path,remote_path)
c.put(open(local_path),remote_path)
c.put(Path(local_path),remote_path)

I have also tried all of the above with remote path only assigned backups.

My goal is for the remote server to have /backups/test after the entire directory is uploaded into that path.

Any guidance would be appreciated.

2
  • Why is what you have tried not good enough? Commented Jun 12 at 21:42
  • What is c in the code you have shown? Commented Jun 12 at 21:46

1 Answer 1

1

Fabric is build on top of Paramiko. And Paramiko does not support directory transfers.

You will find lot of code examples here showing how to implement directory transfers (even recursively) in Paramiko. I guess they should work with Fabric too.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.