Jump to content

[SOLVED] list only folders


shage

Recommended Posts

Check out the is_dir() function. Something like this should let you get directories into an array, and then you could sort them however you like:

<?php
$dir = 'path/to/dir/';
$folders = array();

// ...open your folder connection here and loop over contents

while (false !== ($file = readdir($handle)))
{
  if (is_dir($dir . $file))
  {
    // It's a directory, so add it to the array:
    $folders[] = $file;
  }
}

// ...finish whatever else you need and close your handle
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.