[BASH][HELP] Can someone help me write a script to rename files? - Programming On Unix
Users browsing this thread: 2 Guest(s)
|
|||
So I have a directory with 22 .avi files whose names are like this:
The Mentalist Season 1 E(1).avi The Mentalist Season 1 E(2).avi and so on and so forth. So I would like to change them to The Mentalist S01E01.avi The Mentalist S02E02.avi and so on and so forth. Looking at the problem programatically, I can see the followings steps to arrive at the solution. 1) Process all the files unless there are no more files. 1.1) Find out the number after Season and save it in a variable called $Season. 1.2) Find out the number after E( and save it in a variable called $Episode. 1.3) execute "mv $file The Mentalist S"$Season"$Episode".avi 1.4) done 2 Exit So can someone tell me how can I arrive on the solution using shell scripting for now? One small request is please don't give me direct answer, just point out what linux utilities should I use to come up with the solution. I would like to struggle with it myself. I would have probably renamed those 20 avi files myself my now, but now I have decided to automate everything myself!! Also tvnamer is not working with the format of the files. |
|||
Messages In This Thread |
[BASH][HELP] Can someone help me write a script to rename files? - by neo1691 - 06-09-2014, 05:22 AM
RE: [BASH][HELP] Can someone help me write a script to rename files? - by venam - 06-09-2014, 05:45 AM
RE: [BASH][HELP] Can someone help me write a script to rename files? - by neo1691 - 06-09-2014, 06:22 AM
RE: [BASH][HELP] Can someone help me write a script to rename files? - by z3bra - 06-09-2014, 07:42 AM
RE: [BASH][HELP] Can someone help me write a script to rename files? - by neo1691 - 06-09-2014, 09:32 AM
RE: [BASH][HELP] Can someone help me write a script to rename files? - by z3bra - 06-09-2014, 01:35 PM
RE: [BASH][HELP] Can someone help me write a script to rename files? - by neo1691 - 06-09-2014, 01:38 PM
|