I always use is_file.
Check if a given path is an directory or a file on a given disk
In filesystems.php I have configured 2 disk, one local and one on amazon: 'public' => [ 'driver' => 'local',
's3' => [ 'driver' => 's3',
I'm looking for a method that returns wheather the passed path on a given disk is a directory or not. Something like: $isDir = Storage::disk('s3')->isDirectory('path/to/directory');
I found the following but i didn't found an example that worked: is_dir($thePath) works only on locale files but not on s3 if I'm not wrong laravel.com/api/10.x/Illuminate/Filesystem/Filesystem.html#method_isDirectory laravel.com/api/10.x/Illuminate/Support/Facades/File.html#method_isDirectory
Dose something like that exists?
I tired also to write my own method, that checks if a corresponding folder exists, but this is not so nice in my eyes:
private function isFolder($disk, $folder) { $sourceParentFolder = dirname($folder); $directories = Storage::disk($disk)->directories($sourceParentFolder); return in_array($folder, $directories); }
Please or to participate in this conversation.