public static void deleteDirectoryQuickly(File dir) throws IOException {
  if (!dir.exists()) {
    return;
  }
  final File to=new File(dir.getAbsolutePath() + System.currentTimeMillis());
  dir.renameTo(to);
  if (!dir.exists()) {
    dir.mkdirs();
  }
  if (to.exists()) {
    String deleteCmd="rm -r " + to;
    Runtime runtime=Runtime.getRuntime();
    try {
      Process process=runtime.exec(deleteCmd);
      process.waitFor();
    }
 catch (    IOException e) {
    }
catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  if (!to.exists()) {
    return;
  }
  deleteDirectoryRecursively(to);
  if (to.exists()) {
    to.delete();
  }
}

public static void deleteDirectoryQuickly ( File dir ) throws IOException { if ( ! dir . exists ( ) ) { return ; } final File to = new File ( dir . getAbsolutePath ( ) + System . currentTimeMillis ( ) ) ; dir . renameTo ( to ) ; if ( ! dir . exists ( ) ) { dir . mkdirs ( ) ; } if ( to . exists ( ) ) { String deleteCmd = "rm -r " + to ; Runtime runtime = Runtime . getRuntime ( ) ; try { Process process = runtime . exec ( deleteCmd ) ; process . waitFor ( ) ; } catch ( IOException e ) { } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } if ( ! to . exists ( ) ) { return ; } deleteDirectoryRecursively ( to ) ; if ( to . exists ( ) ) { to . delete ( ) ; } }
try to delete directory in a fast way .
