2017-02-04 80 views
1

我使用这个CLI:AWS S3 CLI:排除不工作

aws s3 sync /home/me s3://meserver/test_me --exclude "*.o" --exclude "error_log" --exclude "access_log" --exclude "*.tgz" --exclude "*.tar.gz" --exclude "*.zip" --exclude "*.log" --exclude "*.tar" 

该.zip和排序排除就好了。但是error_log不是。

upload: ../../home/me/log/error_log to s3://meserver/testme/log/error_log 

我错过了什么?这是确切的文件名。

+2

你可以尝试'--exclude “*/error_log中”' – franklinsijo

回答

1

你的命令说:--exclude "error_log"

然而,复制的对象是log/error_log,因为它不匹配error_log

请注意,该命令使用路径和前缀,而不仅仅是文件名。存储在Amazon S3中的对象的key实际上包含完整路径以及名称。因此,error_log必须完整引用。

您可以使用--exclude "log/error_log"排除文件,或者如果您希望排除所有这些文件,请使用--exclude "*/error_log"

+0

是。解决方案是在模式前添加'* /'。我认为'aws s3 sync'应该像rsync那样工作,不需要'* /'。亚马逊的文档应该举例说明清楚。 – nmgeek

0

尝试:

aws s3 sync /home/me s3://meserver/test_me --exclude "\*.o" --exclude "\*/error_log" --exclude "access_log" --exclude "\*.tgz" --exclude "\*.tar.gz" --exclude "\*.zip" --exclude "\*.log" --exclude "\*.tar"