How to skip files which I don't have permission to read/access when using scandir(), to avoid all the logged errors?
I use `scandir()` to search through dirs on the computer. I have also tried `DirectoyIterator` with the *exact* same result (it appears to use `scandir()` internally). Some sub-dirs apparently have special permissions, for they pollute my error log with things like: scandir(C:\Program Files\Windows Defender Advanced Threat Protection\Classification\Configuration,C:\Program Files\Windows Defender Advanced Threat Protection\Classification\Configuration): Access is denied. (code: 5) I don't need to search through that dir, but `scanddir()` does its thing without me being around to do any checks such as `is_readable` or `continue` based on the dir name or something like that. Who knows how many other dirs I don't have "access" to? Naming them one by one could easily prove to be a nightmare, which is why I just want to skip those which would log an error. But even if I wanted to name them one by one, I can't, since scandir() does its thing with apparently no means to configure it. (That I can tell from the manual.) (Hopefully, this place will have some answers unlike the troll-infested "Insult Exchange" which has become utterly unusable at this point.)