Raynes / fs

File system utilities for Clojure.
453 stars 119 forks source link

copy-dir-into #80

Closed kzar closed 10 years ago

kzar commented 10 years ago

I found myself implementing this function today, does it or similar belong in your library?

(defn copy-dir-into
  "Copy directory into another directory if destination already exists."
  [from to]
  (if-not (exists? to)
    (copy-dir from to)
    (doseq [name (list-dir from)]
      (let [path (str from name)]
        (if (directory? path)
          (copy-dir path to)
          (copy path (str to name)))))))

Cheers, Dave.

Raynes commented 10 years ago

This would be lovely, yes.

Can you shoot me a pull requests (optimally with tests)?

<3

kzar commented 10 years ago

Cool OK I shall give it a go, stay tuned :p

Raynes commented 10 years ago

Added in 1.4.6.