from boto.s3.connection import S3Connection # Following 3/4 lines need to be changed to make this work. aws_key = 'SET AWS KEY here' aws_secret = 'SET AWS SECRET here' bucket_name = 'SET BUCKET name' output_file = 'folders.txt' conn = S3Connection(aws_key, aws_secret) bucket = conn.get_bucket(bucket_name) folders = bucket.list("","/") count = 0 with open(output_file, 'w') as outfile: for folder in folders: count += 1 outfile.write(folder.name[:-1] + '\n') print '.', print('\n\n Completed. Total folders: ' + count)
Above program does two things,
...on system output to show progress and at the end prints count of folders in the given
- Write folder names to the
Apparently this is an icebreaking post for me to start blogging again.
Just started with simple one, more to follow.