def upload(lambda_src, target_bucket, acl, cacheControl): for folder, subs, files in os.walk(lambda_src): for filename in files: source_file_path = os.path.join(folder, filename) destination_s3_key = os.path.relpath(source_file_path, lambda_src) contentType, encoding = mimetypes.guess_type(source_file_path) upload_file(source_file_path, target_bucket, destination_s3_key, s3, acl, cacheControl, contentType)