I want to organize the logical path in s3. Currently it is something like:
a/01-2020/b/file.txt
a/01-2020/c/file2.txt
a/02-2020/b/file.txt
a/02-2020/c/file2.txt
...
For that I'm looking for regex to replace between the date in the second place (by /
delimiter) with the third one
Should look something like that:
a/b/01-2020/file.txt
a/b/02-2020/file.txt
a/c/01-2020/file2.txt
a/c/02-2020/file2.txt
...
In python the code start like that:
s3_client = boto3.client('s3')
objs = s3_client.list_objects_v2(Bucket=bucket, Prefix=prefix)['Contents']
for key in objs:
print(key['Key'])
print(reverse(key['Key'])) <---- reverse() is just an example