Hello 

take a look a the Pear File_Find class

     require_once 'File/Find.php';
     $fs = new File_Find;
     $data = $fs->maptree('my_dir');

     $data[0] contains all directorys
     $data[1] all files 

     $ok = 0;
     $err = 0;
     foreach ($data[1] as $key)
     {
       if (unlink($key)) {
        $ok++;
       } else {
         $err++;
       }
     }

     if there is an error ist is not able to delete the directorys

   // the first directory (in deep) must the last one
   sort($data[0]);

    foreach ($data[0] as $key)
    {
      if(rmdir($key)) ....
    }
 
BR/Torsten

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

Reply via email to