public static boolean deleteDirectory(final File path){
  if (path.exists()) {
    File[] files=path.listFiles();
    for (    File file : files) {
      if (file.isDirectory()) {
        deleteDirectory(file);
      }
 else {
        file.delete();
      }
    }
  }
  return path.delete();
}

public static boolean deleteDirectory ( final File path ) { if ( path . exists ( ) ) { File [ ] files = path . listFiles ( ) ; for ( File file : files ) { if ( file . isDirectory ( ) ) { deleteDirectory ( file ) ; } else { file . delete ( ) ; } } } return path . delete ( ) ; }
deletes directory with files .
