title: List files in a folder that match permission settings
body: <p>Is there a way I can write a script, preferably in PHP, that will list only the files in a folder and all subfolders that match certain permission settings?</p>
  
  <p>I need to check permissions on files within a lot of folders and subfolders, and want to find a way to speed up that process!</p>
  
  <p>So a PHP script that essentially does the following, for example:</p>
  
  <p>"list all files in the directory and subdirectories that have permissions 777"</p>
  
  <p>So only files with permissions 777 would then be listed.</p>
  
  <p>I know how to make a PHP script that lists all files, but struggling with the condition to list only files that match the permission settings.</p>