Question

I am using Python Boto to download all the files in a bucket to my windows system. The problem is that there are subdirectories on the bucket (or whatever you call them). This is my partial code which fails with obvious error that its trying to write to a path that does not exist since it maps S3 path to windows.

logsBucket = s3.get_bucket('mylogs')

for b in logsBucket:
    #Download log
    print b.name
    key = logsBucket.get_key(b.name)
    fp = open("D:\\mylogs\\" + b.name, "w")
    key.get_file(fp)

The key is something like this 'mysite/access/*.gz'

I don't know I could be sleepy or I'll just do this on my linux system, but doing this on windows will be more useful to me.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top