Subject: Re: SCP recursive file transfer

Re: SCP recursive file transfer

From: Sunjith P S <>
Date: Tue, 11 Jan 2011 10:44:57 +0530

  On 10/01/11 11:37 PM, Daniel Stenberg wrote:
> On Mon, 10 Jan 2011, Sunjith P S wrote:
>> It would be nice if there was an API in libssh2 so that D and E SCP
>> protocol messages can be made use of for recursive copying.
> I certainly wouldn't mind having explicit support for recursive SCP.
> Any thoughts on how that API would look like?
Something like:
ssize_t libssh2_scp_send_recursive(LIBSSH2_SESSION *session, const char
*src_path, const char *dst_path);

It should open a channel internally with the given session, read
recursively from source directory and send the directories and files
using D, E, C & T scp protocol messages. The modes for D & C messages,
lengths for C messages and atimes & mtimes for T messages can be read
from local filesystem.

Return value: No. of bytes transferred or negative on failure.
Errors: appropriate LIBSSH2_ERROR_*

We may need a function like scp_send in scp.c with "scp -rt " option in
scpSend_command and mechanism to loop on src_path recursively and
sending appropriate protocol messages and file data.

Thank you.

Received on 2011-01-11