我有一个S3桶,其中有具有格式存储多个日志文件 index.log.yyyy-MM-DD-01 index.log.yyyy-MM-DD-02 。 。
I have a S3 bucket in which there are several log files stored having the format index.log.yyyy-mm-dd-01 index.log.yyyy-mm-dd-02 . . .
yyyy作为今年毫米月份,DD的日期。
yyyy for year, mm for month and dd for date.
现在我想只下载其中的几个。我看到下载一个完整的S3存储?。这个帖子的接受的答案是工作绝对没问题,如果我想下载整个斗,但我应该怎么做,如果我想要做一些模式匹配?我想下面的命令,但他们没有工作:
Now i want to download only a few of them. I saw Downloading an entire S3 bucket?. The accepted answer of this post is working absolutely fine if I want to download the entire bucket but what should I do if I want to do some pattern matching? I tried the following commands but they didn't worked:
aws s3 sync s3://mybucket/index.log.2014-08-01-* .
aws s3 sync 's3://mybucket/index.log.2014-08-01-*' .
我也尝试过使用s3cmd使用下载的目的 http://fosshelp.blogspot.in/2013/06 文章的第7点和 http://s3tools.org/s3cmd-sync 。下面是我跑的命令:
I also tried using s3cmd for downloading purpose using http://fosshelp.blogspot.in/2013/06 article's POINT 7 and http://s3tools.org/s3cmd-sync. Following were the commands that I ran:
s3cmd -c myconf.txt get --exclude '*.log.*' --include '*.2014-08-01-*' s3://mybucket/ .
s3cmd -c myconf.txt get --exclude '*.log.*' --include '*.2014-08-01-*' s3://mybucket/ .
和这几个排列。
谁能告诉我,为什么没有模式匹配的发生呢?或者,如果有,我需要使用其他工具。
Can anyone tell me why isn't pattern matching happening? Or if there is any other tool that I need to use.
谢谢!
推荐答案
找到了问题的解决方案。虽然我不知道为什么其他命令不工作。解决方法如下:
Found the solution for the problem. Although I don't know that why other commands were not working.. Solution is as follows:
aws s3 sync s3://mybucket . --exclude "*" --include "*.2014-08-01-*"
注:--exclude*应来之前--include---,做反向不会打印出任何东西,因为它会执行'排除'后'包括'(现在无法找到引用,我读了这一点)。
Note: --exclude "*" should come before --include "---", doing the reverse won't print anything since it will execute 'exclude' after 'include' (unable to find the reference now where I read this).
相关推荐
最新文章