SHARE
TWEET

Untitled

a guest Dec 12th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import errno
  3. import boto3
  4. import botocore
  5.  
  6.  
  7. resource = boto3.resource('s3')
  8. bucket = resource.Bucket('my-bucket')
  9. client = boto3.client('s3')
  10.  
  11. def download_dir():
  12. objList = client.list_objects(Bucket='my-bucket')['Contents']
  13. for obj in objList:
  14.     obj_Key = obj['Key']
  15.     path,_destPath = os.path.split(obj_Key)
  16.     print ("Downloading file :"+ obj_Key);
  17.     client.download_file('my-bucket', obj_Key, _destPath)
  18.  
  19. download_dir()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top