recursion - check path to see if there is any directory php -


how check if in directory "713" there directory (not files)? has smart enough ignore file existance

    ...     ...      $workrecordfullpath = "/var/www/websites/am_dev/app/webroot/files/submissions/57601/4189/713/";      // check if folder "713" exists          if (file_exists($workrecordfullpath)) {     // check if 713 there directory         if (!is_dir($workrecordfullpath)) {             return true;         }     }      return false; 

    ...     ...      $workrecordfullpath = "/var/www/websites/am_dev/app/webroot/files/submissions/57601/4189/713/";     // directories in "713"     $submissionworkrecordfullpath = glob($workrecordfullpath . '*' , glob_onlydir);      // check if folder "713" exists          if (file_exists($workrecordfullpath)) {     // check if 713 there directory         if (!empty($submissionworkrecordfullpath)) {             return true;         }     }      return false; 

the other solution counting slashes "/"

  $oldqc = 12; // deep number of folders wrok_record_id    $objects = new recursiveiteratoriterator(               new recursivedirectoryiterator($workrecordfullpath),               recursiveiteratoriterator::self_first   );    foreach($objects $name => $object){          // name of flies , directories         $countslashes = substr_count($name,'/');          if ($countslashes>$oldqc) {             return false;         }   }    return true; 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -