peak / s5cmd

Parallel S3 and local filesystem execution tool.
MIT License
2.71k stars 239 forks source link

Any way to "touch" files? (update last-modified date to reset Lifecycle policy timer) #666

Closed GordonGustafson closed 4 months ago

GordonGustafson commented 1 year ago

I've tried things like this to see if the LastModified time updates:

s5cmd cp --expires "2024-10-01T20:30:00Z"  's3://bucket/path/*' s3://bucket/path/

But I get this error:

 InvalidRequest: This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes. status code: 400

I can get the behavior I want with the AWS CLI like so:

aws s3 cp s3://bucket/path s3://bucket/path --recursive --metadata-directive REPLACE

I know I could just copy the data to another path and copy it back to reset the LastModified timestamp, but wondering if there's a better way with s5cmd. Thanks!

denizsurmeli commented 1 year ago

Hi, thanks for mentioning this issue. I believe that what we need to do is add a new flag called metadataDirective to the cp command. Will work on a PR as soon as I can.