(defn delete-file "Delete file f. Raise an exception if it fails." [f] (or (.delete (file f)) (throw (java.lang.IOException. (str "Couldn't delete " f))))) (defn delete-file-recursively "Delete file f. If it's a directory, recursively delete all its contents. Raise an exception if any deletion fails." [f] (let [f (file f)] (if (.isDirectory f) (doseq [child (.listFiles f)] (delete-file-recursively child))) (delete-file f)))