It is currently Sun May 20, 2018 7:26 pm

Filenames fixer

All times are UTC - 6 hours

Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Tue Jun 12, 2007 9:53 am   
User avatar

Joined: Tue Jun 12, 2007 9:12 am
Posts: 3
Well i used the search function but didn't find anyth similar.
I hope i'm not just repeating any previously request :P

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 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 ?

 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 5 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group