This commit is contained in:
mattis 2019-12-13 11:56:16 +01:00
parent 4d467957ee
commit 0d7521d87f

View file

@ -15,26 +15,12 @@
(filter #(not (re-matches ignore-patterns %)) source-list)) (filter #(not (re-matches ignore-patterns %)) source-list))
(defn delete-file-recursive (defn delete-file-recursive
[folder] [folders]
(loop [folder-list (.list folder) (let [file-list (filter #(.isFile %) folders)
file-list (filter ) dir-list (filter #(not (.isFile %)) folders)]
(doseq [file file-list] (io/delete-file file))
file-path-prefix [""]] (when (not (empty? dir-list))
(let [f (first source-list) (recur (drop 1 dir-list)))))
second? (not (nil? (second source-list)))
source-file (io/file folder (str (first file-path-prefix) f))]
(if (.isFile source-file)
(do
(io/delete-file source-file)
(when second?
(recur (drop 1 source-list) file-path-prefix)))
(let [sub-dir-list (.list source-file)
sub-dir-list-count (count sub-dir-list)]
(when (> sub-dir-list-count 0)
(recur (concat sub-dir-list (drop 1 source-list))
(concat (repeat sub-dir-list-count
(str (first file-path-prefix) f "/"))
(drop 1 file-path-prefix)))))))))
(defn file-from-cp (defn file-from-cp
[resource-path] [resource-path]