Reputation: 129
If there is a way to check if given a path/folder/file exists within S3 using the aws s3 CLI?
Upvotes: 0
Views: 1272
Reputation: 14543
Always remember S3 is a flat file system. There are no folders. There are simply filenames with slashes in them.
A work around you can use is upload a simple txt file in every S3 folders and use Get object on then to verify if that path exits. Some thing like this.
f($s3->getObjectInfo("bucketName","folder_name/donotdelete.txt")))
{
//Do Whatever you want to do if folder exists
}
else
{
//Do whatever you want to do if folder doesn't exist
}
Upvotes: 1