code: private File writeCleanupFile(int platformType) throws IOException {
  
          String fileSuffix = ".sh";
  
          if (platformType == SelfExtractUtils.PlatformType_WINDOWS) {
              fileSuffix = ".bat";
          }
  
          File file = File.createTempFile("wlpDelete", fileSuffix);
  
          if (!file.exists()) {
              boolean success = file.createNewFile();
              if (!success) {
                  throw new IOException("Failed to create file " + file.getName());
              }
          }
  
          BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file.getAbsoluteFile()), "UTF-8"));
  
          if (platformType == SelfExtractUtils.PlatformType_UNIX) {
              writeUnixCleanup(file, bw);
          } else if (platformType == SelfExtractUtils.PlatformType_WINDOWS) {
              writeWindowsCleanup(file, bw);
          } else if (platformType == SelfExtractUtils.PlatformType_CYGWIN) {
              writeCygwinCleanup(file, bw);
          }
  
          bw.close();
  
          return file;
      }
docs: Write script file to clean up extraction directory.
  The reason a script is required, rather than a Java
  file delete method or a simple Runtime.exec of an OS
  delete command is because neither work reliably. Even
  after the 'server run process' has ended, Java methods
  and single OS commands have failed to reliably delete
  the extraction directory. This has been observed on
  both Windows and Unix (Ubuntu) platforms.
  It appears there is a lock release latency of some kind
  preventing one-shot deletion from working. So a script
  with a loop is the approach used here. Additionally,
  launching a background script offers the added value
  of doing the delete in the background, even after the
  foreground process has terminated.
  
  @param type is the platform type: unix(1), windows(2), or cygwin(3)
  @return a script File object
  @throws IOException