Filename folder (without [CD])

Any questions? Need some help?
Post Reply
nikeb
Posts: 28
Joined: 13 Jun 2014, 07:26

Filename folder (without [CD])

Post 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.
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filename folder (without [CD])

Post 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}
:idea: Please read the FAQ and How to Request Help.
nikeb
Posts: 28
Joined: 13 Jun 2014, 07:26

Re: Filename folder (without [CD])

Post by nikeb »

I was pretty sure to use it already but....clearly i didn't.

It works like a charm.

Really many Thanks
Post Reply