#1 2009-08-23 00:07

BoraBora
Member
Registered: 2009-08-22
Posts: 4

Capitalize every word's 1rst letter, leaving the rest unchanged

First, thanks a lot for ReNamer! This is a really fine program.

My problem seems very simple: I want to capitalize every word in folder and files names, and leave all other letters as they are.

Some examples:

laVern Baker ---> LaVern Baker
o'Jays ---> O'Jays
patti laBelle ---> Patti LaBelle
2Pac or XTC are unchanged.

I can't use the "Force case for fragments" option because I have more than 70,000 files and folders to rename and there are too many exceptions to list.

Is there a way to do this?

Last edited by BoraBora (2009-08-23 00:07)

Offline

#2 2009-08-23 09:02

rockerist
Member
Registered: 2009-08-22
Posts: 5

Re: Capitalize every word's 1rst letter, leaving the rest unchanged

There is a stupid way to do this but it does what it's suppoesd to big_smile

Insert ' ' as prefix - space indicates the new word
Replace every ' a' with ' A'
Replace every ' b' with ' B'
...

you get the picture. In the end just remove the space from position 1.

smile

Offline

#3 2009-08-23 10:29

narayan
Senior Member
Registered: 2009-02-08
Posts: 470

Re: Capitalize every word's 1rst letter, leaving the rest unchanged

I like rockerist's novel idea!

Just one translit rule, followed by a Cleanup rule (select the "Fix spaces" option).

Last edited by narayan (2009-08-23 10:30)

Offline

#4 2009-08-23 12:03

BoraBora
Member
Registered: 2009-08-22
Posts: 4

Re: Capitalize every word's 1rst letter, leaving the rest unchanged

Nice and simple idea, rockerist!  tongue

Unfortunately, I probably do something wrong because it doesn't work. hmm I added 3 rules:

1 - Insert ' ' as prefix.

2 - Transliterate (direction: forward):

' a= A'
' b= B'
etc.

3 - Fix spaces

Here's the result with a test file:

"laVern Baker ¦ lots and Lots of Love.flac" ---> "laVern baker ¦ lots and lots of love.flac"

The capitalized 'V' of LaVern is untouched, which is good, but the 1rst letter of every word is changed to lowercased.  sad What did I missed?

Offline

#5 2009-08-23 12:09

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: Capitalize every word's 1rst letter, leaving the rest unchanged

You may always use a PascalScript:

var
  Words : TStringsArray;
  TempFileName : WideString;
  i : Integer;
begin
  TempFileName:='';
  Words:=WideSplitString(WideExtractBaseName(FileName), ' ');
  for i:=0 to Length(Words) - 1 do
  begin
    if(Length(Words[i])>0) then
      TempFileName := TempFileName + ' '+ WideUpperCase(Words[i][1]) +
        WideCopy(Words[i], 2, Length(Words[i])-1)
    else TempFileName:=TempFileName + ' ';
  end;
  FileName:=WideCopy(TempFileName, 2, Length(TempFileName)-1)+
    WideExtractFileExt(FileName);
end.

I don't know why the rockerist idea didn't work. I guess it is question to Denis.

Last edited by krtek (2009-08-23 12:17)


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#6 2009-08-23 12:27

BoraBora
Member
Registered: 2009-08-22
Posts: 4

Re: Capitalize every word's 1rst letter, leaving the rest unchanged

krtek wrote:

You may always use a PascalScript:

Your script works perfect! cool I don't know either why rockerist's idea doesn't work, but it may be me not doing it right.

Thanks a lot to all of you!

Offline

#7 2009-08-23 12:34

narayan
Senior Member
Registered: 2009-02-08
Posts: 470

Re: Capitalize every word's 1rst letter, leaving the rest unchanged

I checked out the translit rule. It actually converts everything to lowercase.

Offline

#8 2009-08-23 12:43

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,378

Re: Capitalize every word's 1rst letter, leaving the rest unchanged

rockerist's idea will work, but you have to use Replace rule for it, not Translit!

Translit rule does automatic case conversion with an algorithm adopted specifically for transliteration. Translit rule discard the case on the input, i.e. " a= A" is same as " a= a". Case is decided upon the input fragment.

Offline

#9 2009-08-23 13:21

BoraBora
Member
Registered: 2009-08-22
Posts: 4

Re: Capitalize every word's 1rst letter, leaving the rest unchanged

I knew I was doing something wrong.  tongue Thanks for the answer, den4b.

Offline

Board footer

Powered by FluxBB