The following function can be used to load a directory into s3 via boto.
def uploadDirectory(path,bucketname): for root,dirs,files in os.walk(path): for file in files: s3C.upload_file(os.path.join(root,file),bucketname,file)
Specify the directory path and bucket name as inputs. Files are placed directly in the bucket. Change the last variable of the upload_file () function to put them in "directories".
Jdptet
source share