Renaming multiple files in multiple directories.

Daniel Gimpelevich yellowdog-general@lists.terrasoftsolutions.com
Fri, 17 Sep 2004 15:53:50 -0700


OK, I have your solution:

find ~/oggs -name '*ogg.ogg'|sed 's/ogg.ogg//'|xargs -i mv {}ogg.ogg
{}.ogg

(It's supposed to be one line.)

On Fri, 17 Sep 2004 22:50:51 -0700, Christopher Brown wrote:

> Sorry, I just cant wrap my puzzler around this for some reason.
> 
> Would someone be so kind as to tell me how to rename multiple files in 
> multiple directories using the command line? I don't care if I have to 
> repeat the command a few times and change the path but I just don't want to 
> do this by hand. There are about 1000 files.
> 
> Example:
> While ripping and encoding I accidentally named a good many of my files 
> incorrectly and added extra characters(ogg) before the dot like so: 
> (name-of-songogg.ogg)
> 
> What I want to do is rename all the files so they only have the name and 
> .ogg extension like this: (name-of-song.ogg).
> 
> The directory structure looks like this:
> (notice that the songs are at different levels but all inside the ogg 
> folder)
> /home/user/oggs/artist1/album1/name-of-song1ogg.ogg
> /home/user/oggs/artist2/name-of-song2ogg.ogg
> /home/user/oggs/artist3/greatesthits/album1/name-of-song3ogg.ogg
> 
> 
> Thanks for any assistance,
> Christopher
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general@lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
> HINT: to Google archives, try  '<keywords> site:terrasoftsolutions.com'