在 Google Cloud SDK Shell 上上传名称中带有空格的文件 [英] Upload Files with Space in Name on Google Cloud SDK Shell

查看:33
本文介绍了在 Google Cloud SDK Shell 上上传名称中带有空格的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Google Cloud Storage 的新手,但已设法在网上找到我问题的所有答案,但现在我正在尝试使用 Google Cloud SDK 上传文件,它适用于没有空格的文件this_file_001.txt",但如果我尝试上传带有空格的文件此文件 001.txt",系统将无法识别该命令.我正在使用的有效命令是

I'm new to Google Cloud Storage, but have managed to find every answer to my questions online, but now I'm trying to upload files using the Google Cloud SDK and it works great for files with no spaces "this_file_001.txt" but if I try to upload a file with spaces "this file 001.txt" the system won't recognize the command. The command I'm using that works is

gsutil -m cp -r this_file_001.txt gs://this_file_001.txt

gsutil -m cp -r this_file_001.txt gs://this_file_001.txt

现在带有空格的相同命令不起作用

Now the same command with spaces doesn't work

gsutil -m cp -r 这个文件001.txt gs://这个文件001.txt

gsutil -m cp -r this file 001.txt gs://this file 001.txt

有没有办法完成这个任务?

Is there any way to accomplish this task?

提前致谢.

推荐答案

将参数放在引号中应该会有所帮助.我刚刚使用 Google Cloud Shell 终端 尝试了以下命令,效果很好:

Putting the argument into quotes should help. I just tried the commands below using Google Cloud Shell terminal and it worked fine:

$ gsutil mb gs://my-test-bucket-55创建 gs://my-test-bucket-55/...$回声你好世界">测试文件.txt"$ gsutil cp "测试文件.txt" "gs://my-test-bucket-55/test file.txt"正在复制 file://test file.txt [Content-Type=text/plain]...上传 gs://my-test-bucket-55/test file.txt: 12 B/12 B$ gsutil cat "gs://my-test-bucket-55/test file.txt"你好世界

也就是说,如果可以的话,我会避免使用带有空格的文件名.

That said, I'd avoid file names with spaces if I could.

这篇关于在 Google Cloud SDK Shell 上上传名称中带有空格的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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