From: Nicole on
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
From: 1PW on
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

Hello Nicole:

Although you might very well receive the information you need in the
groups you have posted this to, I would suggest you also post to the
nice folks in the comp.unix.shell group where the "heavy-duty"
"bash/sed/awk" folks are more likely to see this.

They just love this sort of thing!

Best wishes.

--
1PW

@?6A62?FEH9:DE=6o2@=]4@> [r4o7t]
From: Nicole on
On Jun 22, 3:29 pm, ray <r...(a)zianet.com> wrote:

> Are you familiar with 'find'? If not, I can give a little guidance.

That would be great, and hopefully it will be something that can be
done quickly and effectively. I have wasted several hours on this
already...

Thanks!

Nicole

From: Nicole on
On Jun 22, 3:35 pm, 1PW <barcrnahgjuvf...(a)nby.pbz> wrote:

> Although you might very well receive the information you need in the
> groups you have posted this to, I would suggest you also post to the
> nice folks in the comp.unix.shell group where the "heavy-duty"
> "bash/sed/awk" folks are more likely to see this.
>
> They just love this sort of thing!
>
> Best wishes.

Done! Thanks for suggesting it.

Nicole


From: Nicole on
You were right, 1PW! Dan from comp.unix.shell suggested:

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

and it worked like a charm, a perfect solution to that problem!

Thanks again,

Nicole