I have some folders in S3 bucket in which i have files. Since S3 stores data like a unix system and thus the ordering of folder numbers are 1,10,11,12,2,3 instead of 1,2,3,10,11,12..
I'd like to read folders in sequence 1,2,3,10,11,12.. and then read the files in them..
I have attached a snippet along with a code that i'm trying but it's not working the way i want. As you see the folder name has a number(-0.png-analysis,-1.png-analysis,-10.png-analysis,-11.png-analysis,-2.png-analysis) but the sequencing is incorrect.. Is there a way they can be read in 0,1,2,3,10,11 order?
for i in bucket.objects.all():
#print(i.key)
if i.key.endswith('tables.csv'):
#s = i.key.split('-')[2]
print(i.key.split('/')[1])
#print(sorted(s,key = lambda x: x.split('.')))
#p = i.key.split('-')[2]
#print(p)