Firstly, this question was made as a follow up of my previous question: How to batch rename files with "variables"?. I'm just restating it considering Sergey's recommendations.
I use xmbc to view my tv shows. Before I began using xmbc, I batch downloaded the first few seasons of "Bleach". What can I say, I'm an anime fan ;-). These are named: "bleachxx.mp4" where xx is the episode number in respect to the whole series, not to the season. so "bleach21.mp4" is the 1st episode of the second season and 21st overall. The files themselves are, however, divided into their own season folders.
The problem is that the command will rename all the files into "Bleach S0XExx" but because the files have the overall file numbers, bleach52.mp4 --> 'Bleach S03E52.mp4' when there obviously aren't 52 episodes in season 3.
To solve this problem, I would have to subtract the number of episodes in the previous seasons by the overall number and essentially get the specific season number.
Example: If there are 20 episodes in season 1, then 25-20=5 so the 25th episode is the 5th of season 2 and renaming would carry out as normal.
I'm a complete newb in coding, I just suggested a python script as I was told this was an effective way of solving this problem. Can somebody please help me in the step by step process of writing this script? Thanks!
rename
) is] and now that I check the symlinks, on my system, it points toprename
. And what do you mean? give me an example of a filename, and tell me what it needs to be renamed to. – Matt Oct 27 '11 at 02:37sed
. So it was easy to me.. It's pretty easy to use once you get the syntax – Matt Oct 27 '11 at 02:47