jgdoncel
6/10/2014 - 3:27 PM

Eliminar directorio (recursivo) From http://stackoverflow.com/questions/1407338/a-recursive-remove-directory-function-for-php

function deleteDirectoryRecursive($dirPath) {
  foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirPath, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $path) {
    $path->isDir() ? rmdir($path->getPathname()) : unlink($path->getPathname()); 
  }
  rmdir($dirPath);

}