jbardin / scp.py

scp module for paramiko

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transfer directory

dndn10 opened this issue · comments

Hi,
I'd like to transfer a directory including its contained files.
I had to wrap it with my own code to do so ( list files, mkdir, and the use scp.put() )
I can try to code it myself, if you think that's necessary.
Thanks

recursive=True didn't work?

It's also invalid for me to sync local directory to remote directory with the following code:

if not os.path.isdir(local_dir):
    return

self.scp.put(
    local_dir,
    recursive=True,
    remote_path=os.path.join(self.remote_dir, local_dir)
)

it's so simple, but not work for me.

What are the parameters? In what way does it not work?

The CI tests this so I really think it works:

scp.py/test.py

Lines 272 to 275 in f0cc100

self.upload_test(u'cl\xE9/dossi\xE9', True,
[b'dossi\xC3\xA9',
b'dossi\xC3\xA9/bien rang\xC3\xA9',
b'dossi\xC3\xA9/bien rang\xC3\xA9/test'])

All of parameters is shown above. But I can give you the exception error message:

    self.scp.put(
  File "/Users/mcat/miniforge3/envs/torch/lib/python3.8/site-packages/scp.py", line 183, in put
    self._send_recursive(files)
  File "/Users/mcat/miniforge3/envs/torch/lib/python3.8/site-packages/scp.py", line 350, in _send_recursive
    self._send_files([os.path.join(root, f) for f in fls])
  File "/Users/mcat/miniforge3/envs/torch/lib/python3.8/site-packages/scp.py", line 292, in _send_files
    self._send_file(fl, name, mode, size)
  File "/Users/mcat/miniforge3/envs/torch/lib/python3.8/site-packages/scp.py", line 302, in _send_file
    self._recv_confirm()
  File "/Users/mcat/miniforge3/envs/torch/lib/python3.8/site-packages/scp.py", line 386, in _recv_confirm
    raise SCPException(asunicode(msg[1:]))
scp.SCPException: scp: /Users/mcat/Code/lab/few-shot/prompt/src/: No such file or directory

Hope that it can help you find the problem.