Home > front end >  Check if file exists in s3 and read if its present
Check if file exists in s3 and read if its present

Time:10-04

I am new to AWS. I want to read multiple files on a daily basis and need to perform fewer actions on them. The problem is if the file is not created today ill face an error. Since I need to automate this process I need to read a file if only it existed. Else pass and don't throw errors.

Ex = file name - abc2022-10-01 abc2022-10-03

read_from_s3 (file) only if exists else go to the next operation

CodePudding user response:

Basically, you want to know if the key is preset in S3. You can use list_objects_v2 here! The Method will return list of keys over which you can iterate.

  • Related