0

In my s3 bucket, my data is listed as following

test/
dev/
data1.txt
data2.txt

s3_paths = S3_BUCKET.objects.filter(Prefix=prefix_string)

I only wanna get the object of

data1.txt
data2.txt

If there is any way to do it instead of digging into test/ and dev/ folder.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Jaden
  • 192
  • 4
  • 15
  • 1
    Does this answer your question? [Amazon S3 listing "directories"](https://stackoverflow.com/questions/17561432/amazon-s3-listing-directories) – ti7 Jul 07 '21 at 19:55

1 Answers1

1

I figured it out, for this one we only need to add Delimiter='/' that's it.

s3_paths = S3_BUCKET.objects.filter(Prefix=prefix_string, Delimiter='/'). Now it print out all the

prefix_string
data1.txt
data2.txt

without digging into test/ and dev/ folder.

Jaden
  • 192
  • 4
  • 15