Is it possible to copy a directory from a Google Compute Engine instance to my local machine?

此生再无相见时 提交于 2019-12-03 15:41:32

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/46341544/is-it-possible-to-copy-a-directory-from-a-google-compute-engine-instance-to-my-l

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!