Skip to content

Instantly share code, notes, and snippets.

@danielef
Created February 18, 2017 00:45
Show Gist options
  • Save danielef/2815f16f546c58f14ac2991471e4ccd4 to your computer and use it in GitHub Desktop.
Save danielef/2815f16f546c58f14ac2991471e4ccd4 to your computer and use it in GitHub Desktop.
Clojure Renaming a file using java.nio
(defn rename [path-file new-name]
(try
(Files/move path-file (.resolveSibling path-file new-name) (into-array [StandardCopyOption/ATOMIC_MOVE]))
(catch Exception e
(.printStackTrace e)
nil)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment