Basically, I have a huge amount of files (ripped audiobooks) that all have the same garbage in their filenames. I'm wondering how to go about writing a bash script to mass rename them. Example filenames as they stand now:
The First CD - 1x01 - Title 1.mp3
The First CD - 1x02 - Title 2.mp3
The First CD - 1x03 - Title 3.mp3
The First CD - 1x04 - Title 4.mp3
I'd like to have the script ask me what needs to be removed and then do it.
In this case, I want to remove the text: "The First CD - "
The output of the directory above would then be:
1x01 - Title 1.mp3
1x02 - Title 2.mp3
1x03 - Title 3.mp3
1x04 - Title 4.mp3
if you have Python , you can use this script.
eg usage
# ls -1 *Title*mp3
The First CD - 1x01 - Title 1.mp3
The First CD - 1x02 - Title 2.mp3
# filerenamer.py -p "The First CD - " -e "" -l "*Title*mp3" #use -l to check
==>>>> [ /home/The First CD - 1x01 - Title 1.mp3 ]==>[ /home/1x01 - Title 1.mp3 ]
==>>>> [ /home/The First CD - 1x02 - Title 2.mp3 ]==>[ /home/1x02 - Title 2.mp3 ]
# filerenamer.py -p "The First CD - " -e "" "*Title*mp3" #remove -l to commit
/home/The First CD - 1x01 - Title 1.mp3 is renamed to /home/1x01 - Title 1.mp3
/home/The First CD - 1x02 - Title 2.mp3 is renamed to /home/1x02 - Title 2.mp3
# ls -1 *Title*mp3
1x01 - Title 1.mp3
1x02 - Title 2.mp3