I often find myself in a situation where I have a folder containing files which are named according to a certain file naming convention, and I have to go through them manually to rename them to the one I want. A laborious repetitive task.
E.g. 01_artist_name_-_album_title_-_song_title_somethingelse.mp3 -> Song_Title.mp3
So the removal of certain bits of information, replacement of underscores with spaces, and capitalisation. Not just for music, that’s just an example.
I have been thinking about automating this task using Python. Basically I want to be able to input the starting convention and my wanted convention and for it to rename them all accordingly.
Ideally I want to be able to do this in Python on Windows, but I have an Ubuntu machine I could use for this if it was easier to do in bash (or Python on UNIX).
If anyone can shed light on how I might approach this problem (suggestion of IO python commands that read contents of a folder – and rename files – on Windows, and how I might go about stripping the information from the filename and categorising it, maybe using RegEx?) I’ll see what I can make it do and update with progress.
For your special case:
If you want to use regular expression, you have to replace: