Skip to content

Instantly share code, notes, and snippets.

@timvisher
Created March 2, 2011 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timvisher/850917 to your computer and use it in GitHub Desktop.
Save timvisher/850917 to your computer and use it in GitHub Desktop.
(defn do-copy-tree [from to include-globs]
(let [globs-pattern (globs->pattern include-globs)
src-paths (map fs/normpath (filter #(re-matches globs-pattern (.getName %)) (file-seq (io/as-file from))))
from (fs/normpath from)
to (fs/normpath to)
dest-paths (map #(.replaceFirst % from to) src-paths)]
(doall (map fs/copy+ src-paths dest-paths))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment