Page 1 of 1

Replacing a colon with a dash

Posted: 16 Feb 2014, 18:32
by jacox
I have FileBot set up to rename my movie folders and filenames correctly using the following expression:

Code: Select all

//Volumes/Movies/{n} ({y})/{n.upperInitial().space('.')}.{y}.{vf}.{vc}
However, I am running into a small problem when I have movies like this: Seal Team Six: The Raid on Osama Bin Laden

As you can see, there is a colon in the filename which is an illegal character. FileBot notifies me of this and replaces it with a valid character. I want to replace the colon with a dash though. From what I've read this is the way to do so:

Code: Select all

.replaceAll(/[:|]/, " - ")
This doesn't work though, and I'm not sure where to put it. I want to retain the uppercase format for the movie folder name. How do I strip the colon and replace with a dash?

Re: Replacing a colon with a dash

Posted: 17 Feb 2014, 01:28
by Ithiel
Hi jacox,

Yup, that's the correct bit of code to fix the problem, however you need to make sure you add it to both the folder name and the show name.

That should make it something like this:

Code: Select all

//Volumes/Movies/{n.replaceAll(/[:|]/, " - ")} ({y})/{n.replaceAll(/[:|]/, " - ").upperInitial().space('.')}.{y}.{vf}.{vc}
Let me know if that helps :-)

Re: Replacing a colon with a dash

Posted: 21 Dec 2021, 16:58
by rednoah
e.g.

Code: Select all

{ n.colon(' - ') }

Re: Replacing a colon with a dash

Posted: 29 Jan 2022, 08:09
by rednoah