public static void deleteUmptyFoldersInFolder(File folder){
  if (folder.isFile())   return;
  if (folder.listFiles() == null || folder.listFiles().length <= 0) {
    folder.delete();
  }
 else {
    for (    File f : folder.listFiles()) {
      if (f.isDirectory())       deleteUmptyFoldersInFolder(f);
    }
  }
  if (folder.listFiles() == null || folder.listFiles().length <= 0) {
    Logger.appendLog("[FilesUtils][I] deleting because it is empty " + folder.getAbsolutePath());
    folder.delete();
  }
}

public static void deleteUmptyFoldersInFolder ( File folder ) { if ( folder . isFile ( ) ) return ; if ( folder . listFiles ( ) == null || folder . listFiles ( ) . length <= 0 ) { folder . delete ( ) ; } else { for ( File f : folder . listFiles ( ) ) { if ( f . isDirectory ( ) ) deleteUmptyFoldersInFolder ( f ) ; } } if ( folder . listFiles ( ) == null || folder . listFiles ( ) . length <= 0 ) { Logger . appendLog ( "[FilesUtils][I] deleting because it is empty " + folder . getAbsolutePath ( ) ) ; folder . delete ( ) ; } }
cleans the given folder from all it ' s unpty folders
