Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    What did is_readable and scandir return? Commented Jul 20, 2023 at 15:14
  • @shingo how can i check it? Commented Jul 20, 2023 at 15:28
  • Can you please explain the use case? Depending on what you want to do with this result, maybe there are other solutions. For example one odd solution would be to use rmdir, it will remove the directory and return true if the directory is empty, otherwise don't do anything and return false. Commented Jul 20, 2023 at 15:33
  • I tried your function and it works just fine. Try dump is_dir or is_readable to see if your directory really exists. It may take the root directory somewhere else then you think. Commented Jul 20, 2023 at 16:17
  • Did you check for hidden files? Commented Jul 20, 2023 at 16:20