Page 1 of 1

Capitalize first letter from first word only

Posted: 20 Nov 2015, 14:30
by rockas
I want to rename my files by making capital only the first letter of the first word of series name and episode title.

For example i want to rename this

Code: Select all

How.I.Met.Your.Mother.1x03-The.Sweet.Taste.of.Liberty.720p.DIM.mkv
To that

Code: Select all

How i met your mother 1x03 - The sweet taste of liberty.mkv
And NOT to this

Code: Select all

How I Met Your Mother 1x03 - The Sweet Taste of Liberty.mkv
Thanks in advance,
RoCkAs

Re: Rename - Please help

Posted: 20 Nov 2015, 15:04
by rockas
I have managed to do the above with this format

Code: Select all

{n[0].upper()}{n[1..(n.length()-1)].lower()} {sxe} - {t[0].upper()}{t[1..(t.length()-1)].lower()}

Re: Rename - Please help

Posted: 20 Nov 2015, 15:51
by rednoah
Very good! You can make it slightly shorter by using negative indices:

Code: Select all

{n[1..-1].lower()}
@see http://mrhaki.blogspot.tw/2009/03/use-n ... ts-to.html

Re: Rename - Please help

Posted: 20 Nov 2015, 16:09
by rockas
rednoah wrote:Very good! You can make it slightly shorter by using negative indices:

Code: Select all

{n[1..-1].lower()}
@see http://mrhaki.blogspot.tw/2009/03/use-n ... ts-to.html
Oh thank you very much!!! :D :D Just an example from your response...

Code: Select all

{n[0].upper()}{n[1..-1].lower()} {sxe} - {t[0].upper()}{t[1..-1].lower()}