Last active
August 29, 2015 14:13
-
-
Save devrimbaris/7ea9931c03934e97b898 to your computer and use it in GitHub Desktop.
Git command generator for indexed filename renamer
This file contains 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
;;Renames file by adding file numbers incrementally | |
;;To run, execute repl output in shell | |
(ns dba.core.utils | |
(:require [clojure.java.io :as io] | |
[clojure.string :as stri])) | |
(defn- pad-left [s p length] | |
(stri/replace (format | |
(str "%" length "s" ) | |
s) " " p)) | |
(map println (map #(str "git mv \"" (.getName %1) "\" " "\"" | |
(pad-left %2 "0" 4) | |
"_"(.getName %1) "\"" ) | |
(.listFiles (io/file "FILEPATH")) | |
(range))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment