code: private boolean deleteDirectoryWithRetries(File directory, int retryCount) {
      if (retryCount > 100) {
        return false;
      }
      if (FileUtils.deleteQuietly(directory)) {
        return true;
      }
      else {
        try {
          Thread.sleep(10);
        }
        catch (InterruptedException ex) {
          // ignore
        }
        return deleteDirectoryWithRetries(directory, retryCount + 1);
      }
    }
docs: Delete fails sometimes or may be blocked by an editor - give it some time to try again (max. 1 sec).