[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: file extensions -- batch mv'ing, mp3s



> related to that, is this:  is there an easy way ( a quick command or
> script) to covert all the .MP3's to .mp3.  Strangly enough "mv" doesn't
> differentiate between .mp3 and .MP3, so I need to change the name to a
> temporary file first, which makes the task all the more annoying.

That's because the files are on your windows partition; it's vfat, not
mv, that fails to differentiate. Remember, EVERYTHING in UNIX is
case-sensitive. If it's not case-sensitive, then you know it ain't UNIX.

To change .MP3 to .mp3 in a given directory, I do this (anyone know an
easier/more efficient way?):

$ for x in *;do mv -iv "$x" `echo "$x"|sed -e 's/MP3$/mp3/'`;done

But for renaming mp3's specifically, have I got the script for you! I
wrote a perl script that changes something like this:

Artist -- The Song Title.mp3

or even:

(Artist) The Song Title.mp3

to:

artist-the_song_title.mp3

It slices, it dices, it removes spaces, it replaces multiple hyphens
with single hyphens, it converts to lower case, it even handles those
stupid parentheses correctly! The script is attached.

To rename all the files in a directory, use the following shell script:

#!/bin/sh
for x in *.mp3; do mv "$x" `mp3rename.pl "$x"`;done

Having uniformly named mp3s is nice -- especially when you've got a
zillion of 'em. :-D

Attachment: mp3rename.pl
Description: Perl program


Reply to: