Created
February 18, 2017 00:45
-
-
Save danielef/2815f16f546c58f14ac2991471e4ccd4 to your computer and use it in GitHub Desktop.
Clojure Renaming a file using java.nio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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