Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import errno
- import boto3
- import botocore
- resource = boto3.resource('s3')
- bucket = resource.Bucket('my-bucket')
- client = boto3.client('s3')
- def download_dir():
- objList = client.list_objects(Bucket='my-bucket')['Contents']
- for obj in objList:
- obj_Key = obj['Key']
- path,_destPath = os.path.split(obj_Key)
- print ("Downloading file :"+ obj_Key);
- client.download_file('my-bucket', obj_Key, _destPath)
- download_dir()
Add Comment
Please, Sign In to add comment