Page 1 of 1

Filename folder (without [CD])

Posted: 07 Nov 2014, 13:58
by nikeb
Hi guys, i m asking for help cause i try to figured it out by myself and i still miss something...
My wish is to create in the output folder (i.e. "Film") another single movie folder naming as the filename, wich has to cointains the file(s).

In case the movie as 2 files (CD1 and CD2) my goal is to create a folder named like the filename {fn} but excluding the CD1 and CD2 part.

Example

Before

root\moviename.2014.something.cd1.mkv
root\moviename.2014.something.cd2.mkv

after

Film\Moviename.2014.something\moviename.2014.something.cd1.mkv
Film\Moviename.2014.something\moviename.2014.something.cd2.mkv

I'm trying to use this format:

movieFormat = Film/{fn.replace('CD','')}/{fn}

and this replaces only the CD word, and not the 1 or 2.
i also tried that:

movieFormat = Film/{fn.replace('CD[12]','')}/{fn}

But still doesn't work.
Would be amazing if it could work with filenames that don't have CD in their name,
just keeping {fn} as it is.

Thanks in advantage for any help.

Re: Filename folder (without [CD])

Posted: 07 Nov 2014, 15:29
by rednoah
Almost there. Except only String.replaceAll takes regex while String.replace works on string literals.

Code: Select all

Film/{fn.replaceAll('CD[12]','')}/{fn}

Re: Filename folder (without [CD])

Posted: 07 Nov 2014, 15:52
by nikeb
I was pretty sure to use it already but....clearly i didn't.

It works like a charm.

Really many Thanks