mass-renamer tool

Thomas Stivers stivers_t at tomass.dyndns.org
Mon Feb 2 11:07:58 EST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/02/04  9:05 AM -0600, Raul A. Gallegos wrote:
> Hi gang.  Anyone got any scripts or know of where I can find some tools 
> to do some mass-renaming?  For example, I have lots of audio files which 
> are named:
> 
> 12-song-title.ogg
> 
> And I'd like to mass rename them to:
> 
> Artist_-_songtitle.ogg
> 
> Or something to that affect.  I've triewd writing my own script but keep 
> running into problems with the spaces in the files because wsith the mv 
> command they need to be escaped.  It's not as easy as poutting '' around 
> them.
> 
> Any ideas or suggestions?

In the perl package for debian I have the rename tool which IMHO is
convenient for this. If yoi have used regular expressions much it'll
make sense to you. Here is an example

rename 's/\d+-(.*)\.ogg/artist_-_$2.ogg/' *.ogg

This will replace files like 01-Some Song.ogg with artist_-_Some
Song.ogg. You may want to turn all spaces into underscores or visa versa
also.

- -- 
Clarke's Corollary:
Any technology distinguishable from magic is insufficiently advanced.
Thomas Stivers	e-mail: stivers_t at tomass.dyndns.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAHnXd5JK61UXLur0RAsiWAJ9FMcgjdvJpB+rpOtKHd4NGWx0iKgCfQQak
eph6F5alVqNlWpMiBT8HcNU=
=krHR
-----END PGP SIGNATURE-----




More information about the Speakup mailing list