如何将当前目录中的文件包括和复制到s3(而不是递归) [英] how to include and copy files that are in current directory to s3 (and not recursively)

查看:65
本文介绍了如何将当前目录中的文件包括和复制到s3(而不是递归)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些文件要复制到s3.我不想对每个文件进行一次调用,而是希望将它们全部包含在一个调用中(以尽可能提高效率).

I have some files that I want to copy to s3. Rather than doing one call per file, I want to include them all in one single call (to be as efficient as possible).

但是,我似乎只有在添加--recursive标志时才能使它工作,这使得它在所有子目录中都能看到(我想要的所有文件仅在当前目录中)

However, I only seem to get it to work if I add the --recursive flag, which makes it look in all children directories (all files I want are in the current directory only)

这是我现在拥有的命令,可以正常工作

so this is the command I have now, that works

aws s3 cp --dryrun.mybucket-递归--exclude * --include * .jpg

但理想情况下,我想删除--recursive以阻止其遍历,例如像这样的东西(不起作用)

but ideally I would like to remove the --recursive to stop it traversing, e.g. something like this (which does not work)

aws s3 cp --dryrun.mybucket --exclude * --include * .jpg

(我简化了示例,在我的脚本中,我有几种不同的包含模式)

(I have simplified the example, in my script I have several different include patterns)

推荐答案

AWS CLI的S3通配符支持有些原始,但是您可以使用多个-exclude 选项来完成此操作.注意:包含排除的顺序很重要.

AWS CLI's S3 wildcard support is a bit primitive, but you could use multiple --exclude options to accomplish this. Note: the order of includes and excludes is important.

aws s3 cp --dryrun . s3://mybucket --recursive --exclude "*" --include "*.jpg" --exclude "*/*"

这篇关于如何将当前目录中的文件包括和复制到s3(而不是递归)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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