I want to upload folder in S3, but I have lot of folders which have space between their names. It’s an automate process, so could not change the name of the folders manually (from abc d to ‘abc d’).
folder_name = abc d
cmd = 'aws s3 sync'+''+folder_name+'/'+''+s3path+folder_name+'/'
Will be pasting ,my code here. Will be glad if it helps:)
!pip install boto3 ##install boto3
!pip install s3fs ##required package
import pandas as pd
s3 = boto3.client('s3')
s3 = boto3.resource(
# Upload files to S3 bucket
for obj in s3.Bucket('bucket_name').objects.all():
- the last for loop will print the keys of files that you’ve
uploaded (for confirmation).
- aws_access_key_id and aws_secret_access_key – both of these will be available in
your aws profile.