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

查看:107
本文介绍了在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 Creating gs://my-test-bucket-55/... $ echo "hello world" > "test file.txt" $ gsutil cp "test file.txt" "gs://my-test-bucket-55/test file.txt" Copying file://test file.txt [Content-Type=text/plain]... Uploading gs://my-test-bucket-55/test file.txt: 12 B/12 B $ gsutil cat "gs://my-test-bucket-55/test file.txt" hello world

$ gsutil mb gs://my-test-bucket-55 Creating gs://my-test-bucket-55/... $ echo "hello world" > "test file.txt" $ gsutil cp "test file.txt" "gs://my-test-bucket-55/test file.txt" Copying file://test file.txt [Content-Type=text/plain]... Uploading gs://my-test-bucket-55/test file.txt: 12 B/12 B $ gsutil cat "gs://my-test-bucket-55/test file.txt" hello world

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

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

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

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