25

With scp I can add the -r flag to download directories to my local machine via ssh.

When using:

gcloud compute scp -r 

it sais that '-r' is not an available option. Without -r I get an error saying that my source path is a directory. (Implying I can only download single files.)

Is there an equivalent to -r flag for gcloud compute scp command?

ThatBrianDude
  • 2,952
  • 3
  • 16
  • 42

2 Answers2

50

Found it!

GCE offers an equivalent and it is --recurse.

My final command looks like this:

gcloud compute scp --recurse username@instance_name:./* "local_dir"

For some reason I also needed the * behind the source folder to avoid some security issue.

ThatBrianDude
  • 2,952
  • 3
  • 16
  • 42
0

Your gutils already has the right credentials, so just simply do

gcloud compute scp --recurse [the_instance_name]:[the_path_on_gcp_instance_folder] [the_path_on_your_machine]
Areza
  • 5,623
  • 7
  • 48
  • 79