Bulk Rename Files in Bash

Posted by jason on Jan. 30, 2013, 6:12 a.m.
Tags: bash linux

Let's say I have a set of files that all have the same thing wrong with the filename.


$ ls -1 *.ext
badname.other.stuff1.ext
badname.other.stuff2.ext
badname.other.stuff3.ext

I can substitute "badname" with "goodname" for all the files with the following command:


for i in badname.*.ext; do mv $i ${i/badname/goodname}; done


0 comments