code: public static void deleteRecursively(File file) {
          if (file.isDirectory()) {
              for (File c : file.listFiles()) {
                  deleteRecursively(c);
              }
          }
          if (!file.delete()) {
              System.err.println("WARN: unable to delete file: " + file.getPath());
          }
      }
docs: CAUTION: This is equivalent to calling rm -r on file.