Exclude folders based on exact folder name?

Any questions? Need some help?
Post Reply
aaronth07
Posts: 2
Joined: 16 Mar 2022, 08:14

Exclude folders based on exact folder name?

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

Re: Exclude folders based on exact folder name?

Post 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.
:idea: Please read the FAQ and How to Request Help.
Post Reply