I am using scandir() function to get the file list of a network path. I am using an path which I dont have access to. I am trying to use it in if condition,
This works but the Scandir error is also displayed.
The system cannot find the path specified. (code: 3).
failed to open dir: No such file or directory.
I Basically Dont want the scandir error to display.
Ok Thanks. Another question, is_dir() will check if the specified path is a directory or not.
What I am trying to do is, if the directory does not exist the user should get the message like “Directory Missing” but if the path is not Accessible then the user should get “Access Denied”.
Is there any function to check if there is access to the folder?
@John_Betong
Spamming the log file with unnecessary errors is scarcely better than displaying them on screen.
Although this your recommendation is proper by itself, it is irrelevant to the question asked, where the error itself, not the error message have to be treated properly.
@akshay_khairmode
define “Not accessible”. Not accessible by whom? Not accessible for what?
It is a network path so when I put \ip\share into RUN then I get a message Access Denied as my Windows Login does not have access for it,but if a user logs in with another Windows login who has the access for that network share it will work.