Traverse directory - Find empty directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I'm using Spl RecursiveDirectoryIterator to traverse a directory and have no 
problem with it but now I'm stuck. I only need to display directories with 
no files in it.

Can someone help with this?

My current code:

set_time_limit(0);

$files = new RecursiveIteratorIterator(new 
RecursiveDirectoryIterator('c:\dev'), 
RecursiveIteratorIterator::SELF_FIRST);
foreach($files as $file) {
    if ($files->isDir()) {
        echo $file . "<br/>";
    }
}

I have
c:\dev
c:\dev\php
c:\dev\php\file1.php
c:\dev\php\file2.php
c:\dev\php\test
c:\dev\php\test\db

I would like to display 'test' because although there is a 'db'  folder, 
there are no files in c:\dev\php\test



Bets regards,
holo 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux