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
Note: The File::isDirectory() function is used to check whether or not the given path exists.
Laravel's filesystem configuration file is located at config/filesystems.php . Within this file, you may configure all of your filesystem "disks". Each disk represents a particular storage driver and storage location.
None of the answers here seems to answer specifically to check if a particular folder exists in S3. This is what I use and it works:
Storage::disk('s3')->exists('FOLDER_NAME')
The above will return a boolean. The above check works for both folders and filenames.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With