The*_*ude 3 command-line-interface amazon-s3 amazon-web-services
我正在尝试在特定日期范围内列出S3中虚拟文件夹中的文件。例如:2月份已上传的所有文件。
我目前正在运行一个aws s3 ls命令,但这给出了所有文件:
aws s3 ls s3://Bucket/VirtualFolder/VirtualFolder --recursive --human-readable --summarize > c:File.txt
Run Code Online (Sandbox Code Playgroud)
如何获取仅列出给定日期范围内的文件?
您可以使用awk之类的工具过滤结果:
aws s3 ls s3://Bucket/VirtualFolder/VirtualFolder --recursive --human-readable --summarize \
| awk -F'[-: ]' '$1 >= 2016 && $2 >= 3 { print }'
Run Code Online (Sandbox Code Playgroud)
awk使用-、:和空格分隔符拆分每个记录的位置,因此您可以将字段寻址为: