Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow entire directories to be copied (recursively) #61

Open
bramvdbogaerde opened this issue Apr 13, 2022 · 3 comments
Open

Allow entire directories to be copied (recursively) #61

bramvdbogaerde opened this issue Apr 13, 2022 · 3 comments

Comments

@bramvdbogaerde
Copy link
Owner

bramvdbogaerde commented Apr 13, 2022

SCP in source mode has a special flag called "r" that will send the contents of the directory (recursively) to the target (us in the case we are downloading).

The following will need to be implemented (at least):

  • An additional parameter needs to be added to the CopyFromRemotePassThru method (and variants), so that it can be specified that an entire directory needs to be copied
  • A way to specify using a parameter what to do with each individual file from that directory.
  • The "-r" option needs to be passed to the remote scp command
  • We need to support the D control message that specifies that a list of files for a directory is about to be sent.
@hashqueue
Copy link

expect. 😄

@OfficialKris
Copy link

This is something I would be interested in having working for a project I am working on. Are there any specific challenges in implementing this? Does SCP have a special way of doing this? @bramvdbogaerde

@bramvdbogaerde
Copy link
Owner Author

bramvdbogaerde commented Sep 11, 2024

Thanks for bringing this up!

It probably is not particularly difficult to implement. Looking at the specification [1], we would need to support D and E messages which control the start and end of a directory respectively. This feature would probably also entail a change in the public API of this library. This is because of the fact that not all Copy functions accept a filepath as an argument. Instead, they accept an io.Writer which is not aware of file locations, directories, ... So I propose to discuss the API design here first before making any changes.

I welcome any contributions, be it to this discussion, or in the form of a PR.

[1] https://web.archive.org/web/20090806212235/http://blogs.sun.com/janp/entry/how_the_scp_protocol_works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants