LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Script to Rename Many Files (https://www.linuxquestions.org/questions/programming-9/script-to-rename-many-files-432021/)

geeman2.0 04-05-2006 12:21 PM

Script to Rename Many Files
 
I have inherited a massive collection of mp3s from a friend.
Unfortunately it's very disorganized and they're all in one directory.

I'm wondering if there is some sort of shell scripting solution that can solve my file name woes.

Imagine that there were a band named "Linux Questions" and I have a bunch of their mp3s mixed into a directory with thousands of other mp3s.
Unfortunately the file names vary from containing "LINUX QUESTIONS", "linuxquestions", "Linux-Questions", "linux_questions", etc...

I would like to write a script that would find all of these file names, and rename them so they all use the consistent variant of "Linux Questions - SongName".

Hopefully this is clear.
Can anyone point me in the right direction to do this?

xhi 04-05-2006 01:13 PM

the easiest way would be if the id3 tags are accurate, you could use just about anything (lang) to do it.. however if they are not my vote would be with perl, and it has several id3 tag libs available so that you could fix the id3s once you are done..

pljvaldez 04-05-2006 01:16 PM

I've never used any of these, but here's a couple of links to some scripts someone else has already written...

http://linux.softpedia.com/get/Multi...er-10711.shtml
http://www.linuxsoft.cz/en/sw_list.php?id_kategory=135

geeman2.0 04-05-2006 01:45 PM

Unfortunately the ID3 tags seem to be worse than the file names themselves, but I'll still give the linked to scripts a try when I get home.

I've been giving this some more thought today.
What if I could write a regular expression that matches most variations on the artist's name. Is there any type of CLI tool that can match regular expressions and then replace only the part of the file name that matches the expression?


All times are GMT -5. The time now is 07:14 PM.