How to check given folder contains Files in Magento 2?

Magento 2, You can check the given folder path contains the file or not using the isFile() method.

For example, You have an image inside the pub/media folder with path,
$imagePath = ‘/catalog/product/placeholder/default/coming-soon.jpg’;

You can see a placeholder image at the above location in the media folder.

Now you have to check coming-soon.jpg file is exists or not using Magento 2, You need to use the below code snippet,

coming-soon.jpg resides under the given location in the method.

You can check the given path is file exists or not using the above way bypassing the image path only.