To get the subdirectories present in a directory, code are below -
Example -
<?php
$somePath = 'E:\xampp\htdocs\drupal';
$all_dirs = glob($somePath . '/*' , GLOB_ONLYDIR);
echo "<pre>";
print_r($all_dirs);
?>Output -
Array
(
[0] => E:\xampp\htdocs\drupal/New folder
[1] => E:\xampp\htdocs\drupal/core
[2] => E:\xampp\htdocs\drupal/modules
[3] => E:\xampp\htdocs\drupal/profiles
[4] => E:\xampp\htdocs\drupal/sites
[5] => E:\xampp\htdocs\drupal/themes
[6] => E:\xampp\htdocs\drupal/vendor
)
No comments:
Post a Comment