Well i used the search function but didn't find anyth similar.
I hope i'm not just repeating any previously request
I'd like to have a script that given a folder, fix the names of files where they are not "well-formed" to be file names for music or videos.
Lots of time i have folders full of files just like That.author.-.that.title.mp3 or ThAt_tITle.mpg or lots of similar things.
So i think this is not so easy because a script cannot correctly interprate which word means what, so i thought to some little rules that can fit
the files title format that are common ( i still cannot understand why ) on the net.
Well formed name :
Author [- track/episode #] - Title [- something esle].extention
es. "My favorite tv show - 3x12 - The episode title.avi"
( Every field starts with an uppercase and between any field there are space-score-space )
So what shall this script look at file names ?
-when there's a dot or an underscore, it replace with a space ( exept for the last )
-when there are more than one space between 2 words, it reduce them to one
-when there are chars like # @ it removes them
-when there is the tipical "by xxxxxxx" it removes it
-it discover each word sequence separated by score " - " and the track / episode number as a number sequence that can include 'x' || "ep" || "ep." || "Ep" ( and so on.. ) as fields ( and order_field )
-it makes all simple fields lowercase, with the first char ( of each word ? ) uppercase.
-when there are more than 2 fields ( or 3 if there's also the number of the track / episode ) prompt for mantaning them or discarding.
-it moves the file to the new name
"Firstfield - [track number -] Title.ext"
I'm not experienced at all with sh, is this difficult ?