Laravel s3 check if directory exists.

laravel

Solution

Try to get directories list in a parent directory and check if the directory you're looking for is in an array:

in_array('directoryYoureLookingFor', Storage::disk('s3')->directories('parentDirectory'));

I've just checked and this solution works in Laravel 5.3.

Problem

How would I check with Laravel `storage` if a directory exists? In the documentation there is only documented how to check if a file exists. `Storage::disk('local')->exists('file.jpg');` https://laravel.com/docs/5.3/filesystem#retrieving-files

Original source