vagrant-scp icon indicating copy to clipboard operation
vagrant-scp copied to clipboard

Possibility to copy more than one file to VM

Open jakub-olczyk opened this issue 5 years ago • 3 comments

Hi!

I was wondering if it would be possible to copy more than one file to the VM with this plugin. As far as I know, currently we can only copy one file at a time.

In a scenario where I want to copy more than one file I need to do that in a loop, calling vagrant scp command for each file separately. I think that maybe if we could specify more than one file the process would be slightly faster?

I know that this is possible with plain scp so why not take advantage of this ability in vagrant-scp as well? :)

I have no experience with Ruby but I think this wouldn't require a lot of work and need small changes in the parse_args method.

Cheers!

jakub-olczyk avatar Jun 28 '19 10:06 jakub-olczyk

It's possible but only by specifying a directory with multiple files. The plugin will traverse the contents of the file recursively and scp each one. So vagrant scp file1 file2 file3 targetVM:path will not work but vagrant scp dir targetVM:path will. Dir will contain file1, 2 and 3 and they'll end up in your guest VM either way :)

ntkjer avatar Apr 02 '20 18:04 ntkjer

Oh, I forgot about this issue :) Thanks for a reminder @ntkjer :+1:

Yeah, after looking at the source for long enough I found that it indeed does have the possibility to copy entire directories. Still after thinking about it for a bit some time I found that doing this:

$ vagrant ssh-config > conf
$ scp -F conf -r file1 file2 dir default:/vagrant

is still faster for me then downloading the plugin (I needed to have a local copy, and it was used in automation) and issuing more commands. I guess it's just my use case that this plugin isn't supporting that much. Still it was fun to figure out some of this stuff :+1:

Cheers!

jakub-olczyk avatar Apr 03 '20 07:04 jakub-olczyk

for sure vanilla scp is the way to go!

ntkjer avatar Apr 07 '20 20:04 ntkjer