2020-12-30

Move all versions of a given file in a S3 bucket from one folder to another folder

I have set up an S3 bucket with versioning enabled.

One external process is writing the json files, (each json file corresponds to a single Student entity) to the S3 bucket.

I have decided the S3 bucket folder structure as follows:

 s3://student-data/new/ <-- THIS WILL CONTAIN ALL THE UNPROCESSED JSON FILES
 s3://student-data/processed/ <-- THIS WILL CONTAIN ALL THE PROCESSED JSON FILES.

Now, I have a Cron that runs periodically, once at every 6 hours.

New JSON files are written to new folder by external process.

I would like the Cron to process all the JSON files with associated versions in new folder and after processing is over, move all the files with all existing versions in new folder to processed folder.

Here I am able to fetch the current version for a json file written to new folder and move this to processed folder post processing.

But I am not getting an idea regarding how can I move a file with all its versions from new to processed so that in the future I don't have to process same version of a file twice.



from Recent Questions - Stack Overflow https://ift.tt/3mY4Nka
https://ift.tt/eA8V8J

No comments:

Post a Comment