Mass renaming files

      No Comments on Mass renaming files

So, I’m a noob when it comes to linux bash stuff, but I had a situation where I needed to strip the parenthesses out of a bunch of files provided to me because the system they were going into didn’t like them in image file names.

A little bit of google searching lead me to a simple bash answer.  (I knew it was powerfull stuff.)

So, here is the answer to all my problems, typed in to a terminal from the directory I needed to rename files in:

[code]#!/bin/bash
for i in *.jpg
do
x=${i//[()]/}
echo "$i renames to: $x"
mv $i $x
done
[/code]

Thanks to this page for steering me in the right direction: http://www.linuxquestions.org/questions/linux-software-2/how-do-you-remove-parenthesis-from-filenames-using-sed-812975/

Leave a Reply

Your email address will not be published. Required fields are marked *