Brad Lucas

Programming, Clojure and other interests
July 29, 2017

Rename Group Of File Extensions In Git

For this example, I had a collection of text files with embedded mode lines to setup the mode for org-mode. I wanted to do away with the mode line and rename them from txt files to org files.

Build the GLOB before hand and verify with ls. For example ls *.txt would have the GLOB value in the example replaced with *.txt.

The git mv renames the files.

for i in $(find . -iname "GLOB"); do
    git mv "$i" "$(echo $i | rev | cut -d '.' -f 2- | rev).org";
Tags: bash git