CodeIgniter Forums
none recursive get_filenames - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: none recursive get_filenames (/showthread.php?tid=12802)



none recursive get_filenames - El Forum - 10-31-2008

[eluser]koorb[/eluser]
Is there anyway to use get_filenames without it being recursive? I only want the files listed in the directory is specify not in child directories!


none recursive get_filenames - El Forum - 10-31-2008

[eluser]Pascal Kriete[/eluser]
I don't think there is. You could use the directory helper's directory_map function instead. That would leave you with files and directories, so you would have to filter out the directories:
Code:
$this->load->helper('directory');

$dir = './downloads/';
$map = directory_map($dir, TRUE);

foreach($map as $file)
{
    if( ! @is_dir($dir.$file)
    {
        echo $file;
    }
}

Hope that helps.


none recursive get_filenames - El Forum - 10-31-2008

[eluser]koorb[/eluser]
fab, thank you Smile