I want to download the whole bucket "my-bucket" from aws s3 storage, and save it in the path "./resources/my-bucket". So, I'm doing the following, importing boto3, creating a resource with the access_key_id and secret_access_key, then iterating over all the objects in the bucket and downloading them using the download_file api call:
import boto3
s3 = boto3.resource(
service_name="s3",
region_name="us-west-1",
aws_access_key_id="AWUHWIEDFB",
aws_secret_access_key="AOIERJGOERWHJO"
)
for o in s3.Bucket("my-bucket").objects.all():
filename = o.key
s3.Bucket("my-bucket").download_file(Key=filename, Filename="./resources/my-bucket/" + filename)
The s3 bucket my-bucket itself has a folder called "input" with only png and jpg files, and also has another .pt file in the root path.
But I'm getting the error:
FileNotFoundError: [Errno 2] No such file or directory: './resources/my-bucket/input/.F89bdcAc'
I don't know what .F89bdcAc means, and why boto3 is trying to find that file.
How to fix this?