Page 1 of 1

Exclude folders based on exact folder name?

Posted: 10 Apr 2022, 21:56
by aaronth07
Here's the script i'm using (for TV shows):

Code: Select all

!file.isMovie() && none{ f =~ /Featurette|Featurettes|tv-sonarr|seeding|Extras/ } && none{ ext =~ /jpg|png|txt|exe|nfo|website/ }{ fn.match(/sample|trailer/) }
And it has been working pretty well so far. However, I have been having some trouble with not matching some files. After troubleshooting, I realized this is because the containing folder has the word "Extras" in it (e.g.

Code: Select all

TV Show (2022) Season 1 + Extras 
. I thought that

Code: Select all

none{ f =~ /Featurette|Featurettes|tv-sonarr|seeding|Extras/ }
would exclude only exact matches, but it doesn't seem so. This has also been a problem for my movie script too.

So, how can I exclude folders that match the exact folder name only?

Re: Exclude folders based on exact folder name?

Posted: 11 Apr 2022, 02:07
by rednoah
e.g.

Code: Select all

none{ folder.name ==~ /Featurette|Featurettes|tv-sonarr|seeding|Extras/ }

{f} is the file path.
=~ is the regex-find operator.

{folder.name} is the folder name of {f}.
==~ is the regex-matches operator.