You are here

function node_gallery_clean_empty_dirs in Node Gallery 6.2

Same name and namespace in other branches
  1. 6.3 node_gallery.inc \node_gallery_clean_empty_dirs()
1 call to node_gallery_clean_empty_dirs()
node_gallery_delete_image in ./node_gallery.inc

File

./node_gallery.inc, line 269
Node gallery models

Code

function node_gallery_clean_empty_dirs($dirname) {

  //Recursively delete parent directories that are empty, up to the 'files' directory.
  $files = file_scan_directory($dirname, '.*', array(
    '.',
    '..',
  ), 0, FALSE);
  if (count($files) > 0 || $dirname == file_directory_path()) {
    return;
  }
  else {
    rmdir($dirname);
    $dirname = dirname($dirname);
    node_gallery_clean_empty_dirs($dirname);
  }
}