是否可以将目录从Google Compute Engine实例复制到我的本地计算机上? [英] Is it possible to copy a directory from a Google Compute Engine instance to my local machine?

查看:62
本文介绍了是否可以将目录从Google Compute Engine实例复制到我的本地计算机上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用scp,我可以添加-r标志,以通过ssh将目录下载到本地计算机.

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

使用时:

gcloud compute scp -r 

它表示'-r'不是可用的选项. 没有-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.)

gcloud compute scp命令是​​否等同于-r标志?

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

推荐答案

找到了!

GCE提供的等效项是--recurse.

GCE offers an equivalent and it is --recurse.

我的最终命令如下:

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.

这篇关于是否可以将目录从Google Compute Engine实例复制到我的本地计算机上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆