使用 s3cmd,如何在 s3 目录中检索 "Last modfied" 日期的最新文件夹

Using s3cmd, how do I retreived the newest folder by "Last modfied" date in an s3 directory

我有一个包含文件夹的目录,其文件夹名称是使用时间戳创建的。我想使用 s3cmd 查找具有最新 "Last Modified" 值的文件。如果那不可能,那么解决这些先前问题的方法是否可行? looking for s3cmd download command for a certain date

Using S3cmd, how do I get the first and last file in a folder?

s3cmd 可以在本机执行此操作,还是我必须检索所有文件夹名称并对其进行排序?

使用 AWS Command-Line Interface (CLI),您可以列出最近的文件:

aws s3api list-objects --bucket my-bucket-name --prefix folder1/folder2/ --query 'sort_by(Contents, &LastModified)[-1].Key' --output text

第一个(最旧的)对象是:

aws s3api list-objects --bucket my-bucket-name --prefix folder1/folder2/ --query 'sort_by(Contents, &LastModified)[0].Key' --output text