Simple Is Good


Recommended Posts

this below is probably my simplest yet most useful thing I have written. The cool part is, since it is python it runs also on windows. It is a script that searches through a directory and renames files, but takses out extra info that is not needed. for example:

shane@mainbox ~ $ ls sopranos
The_Sopranos_S02E10_-_Bust_Out.jo44.ShareReactor.avi
The_Sopranos_S02E11_-_House_Arrest.jo44.ShareReactor.avi
The_Sopranos_S02E12_-_Knight_in_White_Satin_Armor.jo44.ShareReactor.avi
The_Sopranos_S02E13_-_Funhouse.jo44.ShareReactor.avi

you can have it remove ".jo44.ShareReactor" from each title. Or with a music cd of mine that looks like this

Metallica - 2 X 4.mp3
Metallica - Ain't My Bitch.mp3
Metallica - Bleeding Me.mp3
Metallica - Cure.mp3
Metallica - Hero of the Day.mp3
Metallica - King Nothing.mp3
Metallica - Mama Said.mp3
Metallica - Poor Twisted Me.mp3
Metallica - Ronnie.mp3
Metallica - The House Jack Built.mp3
Metallica - The Outlaw Torn.mp3
Metallica - Thorn Within.mp3
Metallica - Until It Sleeps.mp3
Metallica - Wasting My Hate.mp3

it will clean it up to this

shane@mainbox ~/Load $ ls
2 X 4.mp3
Ain't My Bitch.mp3
Bleeding Me.mp3
Cure.mp3
Hero of the Day.mp3
King Nothing.mp3
Mama Said.mp3
Poor Twisted Me.mp3
Ronnie.mp3
The House Jack Built.mp3
The Outlaw Torn.mp3
Thorn Within.mp3

to use it on winows you just need to drag the script to the directory you want to clean up, and click on it. It will ask you what phrase you want removed.

It also will show you the changes that will be made before making them. It gives you a chance to quit if everything does not look correct

here is the script

http://webpages.charter.net/lindbergfamily/rename.py

Link to post
Share on other sites

I plan on leaving it up for a while.

as to tutorials. got my start with a book, this one was really desighned for the beginner in mind

http://www.amazon.com/exec/obidos/tg/detai...=books&n=507846

as to online tutorials, I can only think of this one off hand. their are probably better ones out there.

http://www.faqs.org/docs/diveintopython

edit added later//

this free online book looks promising

http://www.byteofpython.info/

Edited by shanenin
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...