Hello Team,
Below is the scenario, i need help in S3 using python.
In S3 have a path till Table level manually created, <Bucket-Name> / <Subject-Area> / < Table > / <Year> / <Month>/ <Date> /<keyname>
But is there a way in python , i can dynamically create , Year/Month/Date .
my version of code to retrieve the folder/sub level. Im cautious , not using the word "folder" here, as there is no concept of "folder" in S3.
#!/usr/bin/python
import boto3
import sys
import os
import boto.ec2
from boto.s3.key import Key
import boto.s3.connection
bucket = sys.argv[1]
prefix = sys.argv[2]
client = boto3.client('s3')
result = client.list_objects(Bucket=bucket, Prefix=prefix, Delimiter='/')
for o in result.get('CommonPrefixes'):
print 'folder structure : ', o.get('Prefix')
Please correct if the above approach is wrong or a better way .
Below is the scenario, i need help in S3 using python.
In S3 have a path till Table level manually created, <Bucket-Name> / <Subject-Area> / < Table > / <Year> / <Month>/ <Date> /<keyname>
But is there a way in python , i can dynamically create , Year/Month/Date .
my version of code to retrieve the folder/sub level. Im cautious , not using the word "folder" here, as there is no concept of "folder" in S3.

#!/usr/bin/python
import boto3
import sys
import os
import boto.ec2
from boto.s3.key import Key
import boto.s3.connection
bucket = sys.argv[1]
prefix = sys.argv[2]
client = boto3.client('s3')
result = client.list_objects(Bucket=bucket, Prefix=prefix, Delimiter='/')
for o in result.get('CommonPrefixes'):
print 'folder structure : ', o.get('Prefix')
Please correct if the above approach is wrong or a better way .