[英]Google Cloud Storage Search Files
I'm developing an application that will serve a lot of file. 我正在开发一个将提供大量文件的应用程序。 Lets say it's a car company.
可以说这是一家汽车公司。 Each car has a folder with documents/files for that car.
每辆汽车都有一个包含该汽车的文档/文件的文件夹。 These files are uploaded into categories, represented as "folders" in GStorage.
这些文件被上载到类别中,在GStorage中表示为“文件夹”。 2 files for 2 different cars could look like this:
2种不同汽车的2个文件可能如下所示:
car1/receipt/2016-02-02_payment.pdf
car1/pictures/tires.png
car2/receipt/2016-01-02_payment.pdf
Lets say I want to list all receipts in my application. 可以说我想列出我的申请中的所有收据。 How would I do this?
我该怎么做? Since the search capabilities in Google Cloud Storage is very limited my current proposed solution is to have a mirrored database table with all of the files in it, when i want to access the files i generate the URL for the user.
由于Google Cloud Storage中的搜索功能非常有限,因此我目前建议的解决方案是在其中包含所有文件的镜像数据库表,当我要访问文件时,会为用户生成URL。 It would be very nice is GStorage had a way to search for */ files.
如果GStorage有一种搜索* /文件的方法,那就太好了。
在您的示例中,可以使用带有gsutil
通配符列出存储gsutil
内容来实现此目的:
gsutil ls gs://your-bucket/car*/receipt
gsutil supports * and ? gsutil支持*和? wildcards only for files.
仅用于文件的通配符。 To include folders in the wildcard target you need to double the * or ?
要将文件夹包含在通配符目标中,您需要将*或?加倍。 sign.
标志。 For instance, gsutil ls gs:///**.txt will list all the text files in all subdirectories.
例如,gsutil ls gs:///**.txt将列出所有子目录中的所有文本文件。 The wildcard page offers more details.
通配符页面提供更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.