flogiston

Blog

Ubuntu - rename multiple imgs

· admin · Linux

I wanted to rename a bunch of pictures I had converted to black-n-white:

rename -n 's/\.JPG$/_bw\.JPG/' *.JPG

The -n option doesn't actually rename, it only shows what files would have been renamed to (see man rename). Pretty useful if you're not 100% sure about your regex skills.

To actually do the renaming, leave the -n out:

rename -n 's/\.JPG$/_bw\.JPG/' *.JPG