Skip to content

Instantly share code, notes, and snippets.

@pjgranahan
Last active April 24, 2017 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjgranahan/5f24a396e109c4f8868e5f3c2dba9346 to your computer and use it in GitHub Desktop.
Save pjgranahan/5f24a396e109c4f8868e5f3c2dba9346 to your computer and use it in GitHub Desktop.
Upload folder contents to AWS S3 with Boto3 using Python 3.5+. A simpler alternative to https://gist.github.com/feelinc/d1f541af4f31d09a2ec3
def upload_dir_to_s3(directory):
for file_path in Path(directory).glob('**/*.*'):
site_bucket.upload_file(file_path.__str__(), file_path.relative_to(directory).__str__())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment