From: Dan Stromberg on
On Sun, 22 Jun 2008 15:57:36 -0700, Nicole wrote:

> The task at hand is renaming thousands of files within about one hundred
> directories and subdirectories, and I am sure there must be an easy way
> to do it from the command line, but right now I can't think of it and
> it's driving me mad...
>
> I need to get rid of two specific extensions that were added erroneously
> to the files:
> '_.don' and '.don'
> For instance, files that are now named 'report.kwd_.don'
> 'travel.html.don' and 'miami.txt._.don' must be moved to 'report.kwd'
> 'travel.html' and 'miami.txt'
> and, as I said, I need to process thousands of files like that in over a
> hundred directories and subdirectories that way.
>
> Is there a simple console command I can use within linux that will do
> all that recursively?
>
> Thank you so much for your help.
>
> Nicole

This isn't tested, and I've always done it the sed way, but rename looks
like a nice way of doing it now on Linux systems:

find /dir/hier/archy -type f -print0 | xargs -0 rename _.don ""
find /dir/hier/archy -type f -print0 | xargs -0 rename .don ""

Note though that there's apparently a perl command called rename with
different usage. The above is using the binary (probably a C program)
included with openSUSE 10.3 that's part of util-linux.