I am working with Python Boto to work with S3. Let's say the name of the bucket is... bucket.
In bucket, I have a directory a. Within a, I have many other directories one, two, three... Within each of the directories one, two, three, etc., I have many files.
I am attempting to check if a directory such as a/x exists. I have tried something like this:
key = bucket.get_key('/a/one/')
but no luck. My workaround has been to return
list(bucket.list("a/", "/"))
and see if x exists in the list, but it seems messy. Also, within the returned list, i have 'a/' as a key. If 'a/', a directory, is a key, then shouldn't 'a/one/' also be one?
What is the best way of doing this? Appreciate any help.
Aucun commentaire:
Enregistrer un commentaire