code: private void deleteContents(File dir) {
          if (dir != null && dir.exists()) {
              for (File f : dir.listFiles()) {
                  if (f.isDirectory()) {
                      deleteContents(f);
                  }
                  if (!options.isUnidentifiedArtifactPermitted(f.getAbsolutePath())) {
                      Log.debug("Removing "+f.getAbsolutePath());
                      f.delete();
                  }
              }
          }
      }
docs: Recursively delete a directory and all its contents.