private static void deleteDirectory(File file) throws IOException {
  if (file.isDirectory()) {
    File[] files=file.listFiles();
    if (files != null) {
      for (int i=0; i < files.length; i++) {
        deleteDirectory(files[i]);
      }
    }
  }
  file.delete();
}

private static void deleteDirectory ( File file ) throws IOException { if ( file . isDirectory ( ) ) { File [ ] files = file . listFiles ( ) ; if ( files != null ) { for ( int i = 0 ; i < files . length ; i ++ ) { deleteDirectory ( files [ i ] ) ; } } } file . delete ( ) ; }
deletes a directory recursively .
