shell - 如何获取两个 S3 存储桶之间的文件差异?

标签 shell amazon-web-services unix amazon-s3 aws-sdk

所以我有一个 S3 视频存储桶(数百个),我使用 ElasticTranscoder 将所有内容转码到第二个优化存储桶中。

但是,当我检查第二个存储桶时,对象少了 40-50 个,但我无法弄清楚它们是什么(目录结构嵌套得很深等)。

如何使用 aws s3api list-objects 获取两个存储桶的文件差异?

也许存储桶中有一些不是视频的文件,我不知何故不知道。

最佳答案

使用 Display only filenames :

aws s3 ls s3://bucket-1 --recursive | awk '{$1=$2=$3=""; print $0}' | sed 's/^[ \t]*//' | sort > bucket_1_files
aws s3 ls s3://bucket-2 --recursive | awk '{$1=$2=$3=""; print $0}' | sed 's/^[ \t]*//' | sort > bucket_2_files

diff bucket_1_files bucket_2_files

关于shell - 如何获取两个 S3 存储桶之间的文件差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45513538/

相关文章:

R,将变量传递给系统命令

linux - tr "[1-9]" "[' 0 1'-' 0 9']"无法正常工作

amazon-web-services - AWS CLI - 获取名称以字符串开头的所有 CloudFormation 堆栈

sql-server - 修改 RDS 更改 Microsoft SQL Server 许可类型

mongodb - AWS 是否提供任何托管的 mongoDB 服务?

Linux 开发 |程序文件的良好实践

bash - 在 bash 中的命令之前设置变量

linux - 有没有更好的方法来显示 tmux 中的 cpu 使用情况?

linux - Bash 脚本 : always show menu after loop execution

python-2.7 - Python 中的多个命令行参数