Directory transfers with Paramiko

前端 未结 10 878
刺人心
刺人心 2020-11-30 07:25

How do you use Paramiko to transfer complete directories? I\'m trying to use:

sftp.put(\"/Folder1\",\"/Folder2\")

which is giving me this e

10条回答
  •  再見小時候
    2020-11-30 08:03

    You'll need to do this just like you would locally with python (if you weren't using shutils).

    Combine os.walk(), with sftp.mkdir() and sftp.put(). You may also want to check each file and directory with os.path.islink() depending on whether you want to resolve symlinks or not.

提交回复
热议问题