Server not honoring .plexignore

Server Version#: 1.20.1.3252
Player Version#: N/A

I’ve used .plexignore in the past with this same version of the server and had it work, so I’m not sure why it’s not working now. I suspect a corner case based on order or operations. Here’s what I did and what I see.

While trying to debug a playback problem with some old video files for an old TV show, I’ve been experimenting with re-muxing and re-encoding the show files. To make testing easier, I want Plex to ignore the old files, and I want them out of the way. So under the show root I created an Originals folder and dropped a .plexignore file into it. The ignore file contains one pattern, *, so I believe the server should ignore everything in the Originals and in all sub-folders of the originals folder.

Here’s the complete contents of my .plexignore file:

# Plex will ignore files that match patterns in this file
# The * is a wildcard character

# For now, ignore all files in this folder and subfolders
*

Here are the steps I followed:

  1. Re-mux files from AVI to MKV in the season folders. At this point Plex sees two copies of each episode of the show, as it should.
  2. Create the Originals folder at the show’s root and create .plexignore as shown above.
  3. Create Season folders within the Originals folder
  4. Move (mv -n) the AVI files from the show Season folders to the Originals/Season folders. I expect the AVI files to be ignored now because they are now in a sub-folder of the folder that contains the .plexignore file.
  5. Open up a player and notice that every episode shows two versions.
  6. Open up info on one of the episodes and note that there is info for both the MKV file in the show Season folder AND the AVI file in the show Originals Season folder.

A workaround for this problem is to drop the .plexignore file into each Originals/Season folder. It appears that the server does NOT apply .plexignore rules to sub-folders despite what the documentation says here: If you add the “.plexignore” file to the root (top-level) folder in the content location, the ignore rules will apply to all sub-folders.

I just ran a test on my linux Mint server. I created a .plexignore file with the exact contents of yours, and placed it in my Movies folder (the root of my Movies library. All movies are in their own sub-folders within Movies). When Plex scanned the library, it correctly removed all movies from the library.

What are the permissions on the .plexignore file? You might try setting the permissions to at least read-only at all levels, if they aren’t already, and see if it has an effect.

I’m using Server version 1.20.2.3370, so if nothing else resolves this, there might be an issue in the build you have, but I think that’s unlikely.

Yeah, I’ve seen the same behavior you see in the past with other shows. It’s clearly a corner case, but reproducible (on my system and with this one particular show, at least). FWIW, I’m using Mint to host my Plex server too.

Permissions are rw-rw-r-- and the file is owned by plex:plex. There’s absolutely no reason to think that removing write permission would change the server’s ability to read the file. Beyond that, my workaround did not copy the .plexignore file into the sub-folders; it hard linked it. In other words, it’s exactly the same file in the sub-folders with exactly the same ownership and permissions. The server doesn’t have any trouble reading it in the sub-folders. There’s only one actual copy of the file. If the server can read it in the sub-folders, it can read the file in the top level folder. Further, all folders in the entire Plex library tree are drwxrwsr-x plex:plex. The problem isn’t permissions preventing the server from traversing the tree either.

It’s kind of a puzzler, but I’m sure the engineers at Plex can figure it out if they want to. At this point I’m really just reporting a minor bug rather than asking for help resolving the problem. My workaround is a mildly irritating necessity, but it’s no different than if Plex only supported ignoring the directory that contains the ignore file.

may I suggest ./* as the specification?

Also, the superior (parent) subdirectory could have an ignore file in it to prevent even entering the subdirectory.

( I am looking at the scanner source. If I read this correctly, having the directory component (./) is where the magic is. It allows the * to associate with the filename part even if a subdirectory )

So in order to make the scanner look in sub-folders, there needs to be a ‘/’ in the pattern? If so, I suggest that the documentation needs updating. But I don’t think that’s it. See below.

Here’s what I tried. The results are interesting (and non-intuitive based on what you’ve said):

  1. Remove the link to the .plexignore file from all Originals/Season folders. The scanner immediately goes to work and Plex once again shows two versions of the video for every show.
  2. Edit the .plexIgnore file in the Originals folder, changing the pattern from * to ./* as suggested. No change. All episodes still show two versions of the video.
  3. Re-link the .plexignore file in the Originals folder to each of the Originals/Season folders. Plex STILL shows two versions of the video for each episode!
  4. Revert my change to .plexignore. The versions of the episodes in the Originals tree disappear.

Your move. :slight_smile:

careful please.

Not / (which starts a full path specification).

Use ./* to ignore all items from this (.) point which are found (*)

Remember, Dot (.) means “current directory” when using relative addressing.

The process works by using

Library_Root_Dir / ignore specification.

So in /nas/movies/private,

Placing ./* in .plexignore in private will ignore everything it finds there.

also

Placing ./private in /nas/movies will have the same effect

Addendum,
Please share with me enough of names and your actual specification so I may construct a controlled test case ?

I just found something. I don’t remember it working this way.

I am using sample files (from users)

drwxr-xr-x  2 chuck chuck        4096 Nov 28  2019 Tangled/
-rw-rw-r--  1 chuck chuck  3434914986 Aug 20 15:05 Taxi 5 (2018) Bluray-1080p.mkv
-rw-rw-r--  1 chuck chuck 27526804614 Aug 20 22:08 Taxi 5 - playlist 0.mkv
-rw-rw-r--  1 chuck chuck 27526934241 Aug 20 22:11 Taxi 5 - playlist 1.mkv
-rw-rw-r--  1 chuck chuck 27517336635 Aug 20 21:51 Taxi 5- playlist 1.mkv
-rw-r--r--  1 chuck chuck    10240000 Feb 22  2020 TB.mp4
drwxr-xr-x  2 chuck chuck        4096 Feb  4  2020 The Matrix/
drwxr-xr-x  2 chuck chuck        4096 Nov 27  2019 The Matrix Reloaded/
-rw-r--r--  1 chuck chuck  1429234071 May  6 15:44 Toy Story 2a.mkv
-rw-r--r--  1 chuck chuck  1429234071 Feb 25  2020 Toy Story 3 (2010).mkv
-rw-r--r--  1 chuck chuck  1429234071 May  6 15:47 ToyStory3.xxx
-rw-r--r--  1 chuck chuck  1188528518 Mar 20  2020 TS3%-eac3.mkv
-rw-r--r--  1 chuck chuck        3662 Jul  9 12:14 TS3%-eac3.srt

notice the Toy Story and Taxi files.

Using vi, I created

[chuck@lizum samples.175]$ vi .plexignore
[chuck@lizum samples.176]$ cat .plexignore
*

[chuck@lizum samples.177]$ 

(it does have a trailing EOL character)

30 seconds later, auto detect engages and filters.

Now, change to T* and all the names beginning with T are removed.

Lastly,

One per line removes as specified

[chuck@lizum samples.179]$ cat .plexignore 
B*
C*
D*


[chuck@lizum samples.180]$ 

I’m not saying it doesn’t work in some circumstances. In fact, I explicitly stated in my initial post that I have seen the ignore feature work properly. What I’m trying to tell you is that I have found a case where it does not work, and I have described that case to you above. I also followed your suggestion, replace the pattern * with the pattern ./* (Aside: Why did you expect that change to resolve the problem? Both patterns normally refer to the same set of files: “all files in the current working directory”). Regardless, your suggestion did not resolve the problem on my server.

I’ll try to come up with a simplified version that demonstrates the problem. But what do you mean by “your actual specification?” I shared the entire contents of the .plexignore file with you. Is there some other specification elsewhere that you need to see? If so, where is it found?

OK. Here we go. The first series of pictures shows what happens when the pattern in .plexignore is *. The documentation says that pattern should match all files in the directory containing the .plexignore file and all sub-directories of that directory.

Here’s the structure of the files and folders, as well as the contents of the .plexignore file. The root of this particular Plex library is /mnt/wd10T/tvshows.

david@myplex:/mnt/wd10T/tvshows/JAG$ ll
total 52
drwxrwxr-x  13 plex plex 4096 Sep 29 13:46  ./
drwxrwsr-x 100 plex plex 4096 Sep 28 22:26  ../
drwxrwsr-x   3 plex plex 4096 Sep 29 16:41  Original/
drwxrwsr-x   2 plex plex 4096 Sep 29 12:35 'Season 1'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 10'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 2'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 3'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 4'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 5'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 6'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 7'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 8'/
drwxrwsr-x   2 plex plex 4096 Sep 29 13:07 'Season 9'/
ddavid@myplex:/mnt/wd10T/tvshows/JAG$ ll Season\ 1
total 7842008
drwxrwsr-x  2 plex plex      4096 Sep 29 12:35  ./
drwxrwxr-x 13 plex plex      4096 Sep 29 13:46  ../
-rw-rw-r--  1 plex plex 730391209 Sep 29 12:32 'JAG - S01E01-02 - A New Life.mkv'
-rw-rw-r--  1 plex plex 365127525 Sep 29 12:32 'JAG - S01E03 - Shadow.mkv'
-rw-rw-r--  1 plex plex 364879092 Sep 29 12:32 'JAG - S01E04 - Desert Son.mkv'
-rw-rw-r--  1 plex plex 364550121 Sep 29 12:32 'JAG - S01E05 - Deja Vu.mkv'
-rw-rw-r--  1 plex plex 365000553 Sep 29 12:32 'JAG - S01E06 - Pilot Error.mkv'
-rw-rw-r--  1 plex plex 364657111 Sep 29 12:32 'JAG - S01E07 - War Cries.mkv'
-rw-rw-r--  1 plex plex 365351183 Sep 29 12:32 'JAG - S01E08 - Brig Break.mkv'
-rw-rw-r--  1 plex plex 364781363 Sep 29 12:32 'JAG - S01E09 - Scimitar.mkv'
-rw-rw-r--  1 plex plex 364852649 Sep 29 12:32 'JAG - S01E10 - Boot.mkv'
-rw-rw-r--  1 plex plex 364606084 Sep 29 12:32 'JAG - S01E11 - Sightings.mkv'
-rw-rw-r--  1 plex plex 364889244 Sep 29 12:33 'JAG - S01E12 - The Brotherhood.mkv'
-rw-rw-r--  1 plex plex 365199555 Sep 29 12:33 'JAG - S01E13 - Defensive Action.mkv'
-rw-rw-r--  1 plex plex 365050157 Sep 29 12:33 'JAG - S01E14 - Smoked.mkv'
-rw-rw-r--  1 plex plex 365159671 Sep 29 12:33 'JAG - S01E15 - Hemlock.mkv'
-rw-rw-r--  1 plex plex 365140230 Sep 29 12:33 'JAG - S01E16 - High Ground.mkv'
-rw-rw-r--  1 plex plex 365384308 Sep 29 12:33 'JAG - S01E17 - Black Ops.mkv'
-rw-rw-r--  1 plex plex 365059474 Sep 29 12:33 'JAG - S01E18 - Survivors.mkv'
-rw-rw-r--  1 plex plex 365131991 Sep 29 12:33 'JAG - S01E19 - Recovery.mkv'
-rw-rw-r--  1 plex plex 365384678 Sep 29 12:33 'JAG - S01E20 - The Prisoner.mkv'
-rw-rw-r--  1 plex plex 364877562 Sep 29 12:33 'JAG - S01E21 - Ares.mkv'
-rw-rw-r--  1 plex plex 364627851 Sep 29 12:33 'JAG - S01E22 - Skeleton Crew.mkv'
david@myplex:/mnt/wd10T/tvshows/JAG$ cd Original
david@myplex:/mnt/wd10T/tvshows/JAG/Original$ ll
total 16
drwxrwsr-x  3 plex plex 4096 Sep 29 16:34  ./
drwxrwxr-x 13 plex plex 4096 Sep 29 13:46  ../
-rw-rw-r-- 11 plex plex  151 Sep 29 15:05  .plexignore
drwxrwsr-x  2 plex plex 4096 Sep 29 16:38 'Season 1'/
david@myplex:/mnt/wd10T/tvshows/JAG/Original$ ll Season\ 1/
total 716344
drwxrwsr-x 2 plex plex      4096 Sep 29 16:38  ./
drwxrwsr-x 3 plex plex      4096 Sep 29 16:34  ../
-rw-rw-r-- 1 plex plex 733521920 Sep 29 16:31 'JAG - S01E01-02 - A New Life.avi'
david@myplex:/mnt/wd10T/tvshows/JAG/Original$ cat .plexignore 
# Plex will ignore files that match patterns in this file
# The * is a wildcard character

# For now, ignore all files in this folder and subfolders
*

And here’s what appears on the Plex screen. Note that two episodes are shown for S01E01. One is the .avi file shown above in /mnt/wd10T/tvshows/JAG/Original/Season\ 1. The other is the episode’s .mkv file in /mnt/wd10T/tvshows/JAG/Season\ 1. By the documentation, I expect the copy in /mnt/wd10T/tvshows/JAG/Original/Season\ 1 to be filtered out by /mnt/wd10T/tvshows/JAG/Original/.plexignore. It is not.

Next, I link the .plexignore file into the Season\ 1 directory:

david@myplex:/mnt/wd10T/tvshows/JAG/Original$ ln .plexignore Season\ 1/
david@myplex:/mnt/wd10T/tvshows/JAG/Original$

Success! The extra copy of the episode is filtered out. But why did I need to place a .plexignore file in the Season\ 1 directory? The documentation says that the one in Original should filter out files in sub-directory.

Now, I remove .plexignore from the sub-directory to prove that it is not the ignore file in the Original folder that did the filtering.

david@myplex:/mnt/wd10T/tvshows/JAG/Original$ rm Season\ 1/.plexignore 
david@myplex:/mnt/wd10T/tvshows/JAG/Original$ 

Et voila. The scanner once again finds the second copy of the episode file.

-----------------------End of Test Case Using * as Pattern---------------------

Now let’s try your suggestion that I use ./* as the pattern. I’ll use the same setup as before except this time the single pattern in .plexignore is ./*.

david@myplex:/mnt/wd10T/tvshows/JAG/Original$ vi .plexignore 
david@myplex:/mnt/wd10T/tvshows/JAG/Original$ ll
total 16
drwxrwsr-x  3 plex plex 4096 Sep 29 16:41  ./
drwxrwxr-x 13 plex plex 4096 Sep 29 13:46  ../
-rw-rw-r-- 11 plex plex  153 Sep 29 16:41  .plexignore
drwxrwsr-x  2 plex plex 4096 Sep 29 16:41 'Season 1'/
david@myplex:/mnt/wd10T/tvshows/JAG/Original$ ll Season\ 1/
total 716344
drwxrwsr-x 2 plex plex      4096 Sep 29 16:41  ./
drwxrwsr-x 3 plex plex      4096 Sep 29 16:41  ../
-rw-rw-r-- 1 plex plex 733521920 Sep 29 16:31 'JAG - S01E01-02 - A New Life.avi'
david@myplex:/mnt/wd10T/tvshows/JAG/Original$ cat .plexignore 
# Plex will ignore files that match patterns in this file
# The * is a wildcard character

# For now, ignore all files in this folder and subfolders
./*
david@myplex:/mnt/wd10T/tvshows/JAG/Original$ 

Once again, Plex shows two copies of the S01E01:

Next I link the .plexignore file into the Season\ 1 folder.

david@myplex:/mnt/wd10T/tvshows/JAG/Original$ ln .plexignore Season\ 1/
david@myplex:/mnt/wd10T/tvshows/JAG/Original$

This time the scanner doesn’t filter out the .avi file even though the .plexignore file is in the same directory. Why?

I conclude that the pattern ./* does not match any files at all. I further conclude that Plex’s pattern matching algorithm is broken. If I were on site there, I’d write a bug, but it’s a fairly minor bug because there’s an easy workaround: put a .plexignore file in every directory you want files ignored from.

Where is this ‘second copy’ ?

Hover over the item -> Get Info -> What is it’s path?

do you have directories / paths crossed somewhere unexpectedly / hard links / symbolic links ?

I just ran a test on the entire QA TV test library.

I gave it the pattern: *My* (All series with the name My in it).

It worked.

[chuck@lizum tv.206]$ cat .plexignore 
*My*
[chuck@lizum tv.207]$ 

Before

After

I will now attempt to filter out a specific season

It did not immediately remove it but eventually did.

Testing further

I can pick the episode by naming spec.

[chuck@lizum Season 05.228]$ cat .plexignore
*E05*
[chuck@lizum Season 05.229]$ 

I apologize but I must be misunderstanding something in your needs.

I was able to reproduce what you describe on my Plex Docker. I was able to cause it to ignore the files in subdirectories of “Original” by using */* instead of * in my .plexignore file (in the “Original” directory).

However, I believe the behavior you describe may be consistent with the documentation anyway. The docs state that applying that rule to the root folder of the content location will cause it to be applied to all sub-folders. “Original” in this case is not the top-level of a content location; it is itself already a sub-folder.

My assumption is that root/top-level refers to the folder added to the library folder path in its configuration.

@pshanew

Your statement

is correct. That’s how Plex looks at it.

Where is this ‘second copy’ ?
One copy (the one I expect the scanner to pick up is in:
/mnt/wd10T/tvshows/JAG/Season\ 1
The second copy is in:
/mnt/wd10T/tvshows/JAG/Original/Season 1
The .plexignore file is in:
/mnt/wd10T/tvshows/JAG/Original (the parent directory to the directory containing the second copy)

/mnt/wd10T/tvshows is bind mounted at /home/plex/tv. Here’s the line from fstab:
`/mnt/wd10T/tvshows /home/plex/tv none bind 0 0
The Plex server software sees everything relative to /home/plex.

Hover over the item → Get Info → What is it’s path?
The two paths are
/home/plex/tv/JAG/Season 1/JAG - S01E01-02 - A New Life.mkv
and
/home/plex/tv/JAG/Original/Season 1/JAG - S01E01-02 - A New Life.avi

From Plex’s perspective, the .plexignore file is in /home/plex/tv/JAG/Original. That ignore file should cover all files in the tree below that point.

Here’s a picture:

do you have directories / paths crossed somewhere unexpectedly / hard links / symbolic links ?
No.

  • All television library files are on the same volume.
  • There are no symbolic links within or from the outside into the library.
  • It is not possible to hard link directories on a Linux file system

The only slightly unusual thing about my plex data tree is that tvshows and movies are kept on separate volumes and the places where they are kept are bind mounted into the plex directory tree at /home/plex/tv and /home/plex/movies

My assumption is that root/top-level refers to the folder added to the library folder path in its configuration.

So to get plex to look at subfolders, the only place the ignore file can go is the root of the Library? That explains my difficulty. I was expecting behavior similar to .gitignore files which can be placed anywhere in the tree and affect all directory levels below.

FWIW, the phrase “root (top-level) folder in the content location” is somewhat confusing. “Content,” apparently, means “Library.” I had guessed it meant “any directory tree that contains media.” Oh well.

I suggest rephrasing the documentation from “If you add the “.plexignore” file to the root (top-level) folder in the content location, the ignore rules will apply to all sub-folders,” to “If you add the “.plexignore” file to a root folder of your library, the ignore rules will apply to all sub-folders of that root in the library.”

Thanks to both of you for digging into this.

No problem.

In your case, you should be able to use */* in the .plexignore in"Original" to cause it to ignore any files in it and its sub-directories. I also tested moving that same .plexignore file down to the show-level and it prevented any episodes from being detected. So that works for at least two directory levels.