简体   繁体   English

使用 aws cli 在 S3 中复制文件夹 + 附加日期时间戳

[英]Copy folder + append datetimestamp in S3 using aws cli

Does anyone know how to copy a whole folder to s3 and append date and timestamp to that folder?Example, when I run this command:有谁知道如何将整个文件夹复制到 s3 并将日期和时间戳附加到该文件夹​​?例如,当我运行此命令时:

 aws s3 cp sourcefolder s3://somebucket-test-bucket/ --recursive

Then in my bucket I want to see "sourcefolder+datetimestamp" uploaded.然后在我的存储桶中,我想看到上传的“sourcefolder+datetimestamp”。 That way my folder doesn't get overwritten as it has a unique name.这样我的文件夹就不会被覆盖,因为它有一个唯一的名称。

There is no way to do that using the CLI, unless you provide the timestamp as part of the parameters.使用 CLI 无法做到这一点,除非您提供时间戳作为参数的一部分。

bash example: aws s3 cp sourcefolder s3://my-bucket/foldername+$(date +"%d-%m-%y")/ bash 示例: aws s3 cp sourcefolder s3://my-bucket/foldername+$(date +"%d-%m-%y")/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM