I'm using Laravel to gather directories from a drive using Storage::disk()->directories();
. But I can see that it gathers all the hidden files as well, I'm using Windows so there is a few hidden folders i don't want it to gather. Is there a option or configuration to easily remove them? Or would I have to specify each item I don't want in the array and remove them one by one?
The ones I don't want to see in the array are things like: System Volume Information
or $Recycle.bin
etc..
You can use array filter to remove those that you don't want.
Something like that
$directories = array_filter(Storage::disk()->directories(), function ($directory) {
return !in_array($directory, ['System Volume Information', '$Recycle.bin']);
});
If you want a list of basic files that you may want to escape, you can take a look at that https://www.gitignore.io/api/windows