I'm currently working with Amazon S3 and I am writing a program that uses the modified dates. I'm looking for a way to edit the modified dates.
I could loop trough all the files and save them as they are, but this sounds like a bad solution.
In PHP there is this function touch().
Does anyone know a solution, or has the same problem?
Reading objects without downloading them Similarly, if you want to upload and read small pieces of textual data such as quotes, tweets, or news articles, you can do that using the S3 resource method put(), as demonstrated in the example below (Gist).
In the Amazon S3 console, choose your S3 bucket, choose the file that you want to open or download, choose Actions, and then choose Open or Download. If you are downloading an object, specify where you want to save it. The procedure for saving the object depends on the browser and operating system that you are using.
S3 URL: Enter the path to the Amazon S3 bucket, folder, or file that contains the data for your job. You can choose Browse S3 to select the path from the locations available to your account. Recursive: Choose this option if you want AWS Glue Studio to read data from files in child folders at the S3 location.
S3Uri : represents the location of a S3 object, prefix, or bucket. This must be written in the form s3://mybucket/mykey where mybucket is the specified S3 bucket, mykey is the specified S3 key.
In response to @Daniel Golden's comment on @tkotisis answer. It looks like at least the AWS CLI tools do not let you copy an item on to itself. You can however 'force' a copy by updating the metadata.
$ aws s3 cp --metadata '{"touched":"now"}' s3://path/to/object s3://path/to/object
This recreates the object (downloads to the caller and reuploads it) replacing its content, owner and metadata. This will also trigger any attached Lambda events.
You can achieve the same through a copy object request, specifying the CopySource to be same as the target key.
In essence, this will issue a PUT Object - COPY request to S3 with the corresponding source and target bucket/key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With