Home keyboard_skateboard

Bash: change extension for multiple files

Today I needed to change the extension for a batch of files. I didn't wanted to do this manually so I worked out a simple oneliner. Might be useful!

for i in $(find . -name "*.OLD"); do mv $i ${i%.OLD}.NEW; done

Simply replace OLD and NEW and run this in the directory you want to change files from. This script works recursively so better don't start from "/".


Written by svenv on July 10, 2015 Permalink