Deleted items no longer removed from database

Dear All,

I’m using the latest Plex Media Server on a Synology DS218+ with multiple clients.

One of my libraries is my “Downloads” folder where I download movies to, but later either delete or move them to another folder.

The problem is that the server won’t remove the deleted items - the folder will still be there, either empty or with the movie itself labeled as unavailable. Yes, I know that Plex isn’t designed primarily to be browsed by folders, but for a temporary directory with mixed content there is no reason to setup a media library.

This problem happens since an update that happened a few months ago, did not have the problem before.

I have tried all the tips found here, including empty the trash, allow media deletion, scan, refresh metadata, etc. The only workaround I have is to temporarily change the library to a completely different folder then revert to the original, but of course it is inconvenient… Any change to make this work again?

Any comment is greatly appreciated.
Thanks,
Csaba

The new scanners do behave differently.
You should make sure to have Scheduled Tasks set to keep the database in proper state. This includes Emptying the trash, cleaning the bundles, and optimize database (all checkboxes you’l find there).

Deleting media is intended for DVR which doesn’t usually create the different structures most 3rd party clients do. Movies are intended to be permanent while television DVR can be both perm or temporary.

Common tools such as FileBot, which do run automated, are designed to move things and clean up after themselves. IIRC, download clients are the same.
You can also write a fairly simple script (Task Scheduler) to look for empty directories and delete them.

Remember, the empty directory isn’t so much the problem as the database not being in sync with the actual files on disk.

1 Like

Thanks for your reply.

Only one scheduled maintenance task was not enabled (update libraries), I have enabled that too and set scheduled tasks to run from 1-7AM. Unfortunately 2 days have passed and there is no change.

Anything else I could do? Unfortunately I am not familiar with script writing and I can’t find a way to manually remove empty directories either.

Thanks for your support!

bump…

Can you show me what’s happening?
DEBUG log files are best.
Screenshots showing what I see in the logs is even better.

1 Like

Thank You, Chuck. So shall I set Debug Level to Enabled, then Scan Library Files and post screenshots of the debug log?

Still waiting on you.

Sorry for delay. Not sure why I wasn’t notified.

Yes, Please Enable DEBUG, keep VERBOSE disabled.

When recreated, let sit for 20 seconds after the recreation, then
Settings - Server - Troubleshooting - Download Logs

Attach the ZIP file it gives you here for me please.

It’s my turn to apologize for the late reply.

Here you go, logs attached as requested. The library that shows the problem is the one called “NAS-Downloads”

Thank you for your supportPlex Media Server Logs_2019-12-03_13-31-48.zip|attachment (5.6 MB)

Would you mind trying that upload again please directly in the forum?

Email attachments are not accepted by the forum software (too much risk of spam & viruses)

That wasn’t an email attachment, I click reply, then upload, then from my device and browse for the ZIP file. Anyways, retrying.

Plex Media Server Logs_2019-12-03_13-31-48.zip (5.6 MB) Plex Media Server Logs_2019-12-03_13-31-48.zip (5.6 MB)

Should you need additional information, don’t hesitate to contact me.

and bump…

I’m sorry for the extreme delay responding. I didn’t receive notification until today.

I reviewed the logs and find no errors in them.

When you “delete” the media, and it’s not removed from the “database”, do you mean Library section?

No problem. I delete the media (folders and files) via Total Commander and yes, they are no longer removed from the library even after scan, analyze, empty trash etc.

If the files are deleted, the directory scanned, and trash emptied, they should be gone.

There were no errors in your logs. I’ve never seen this condition.

Can you show me what you see?

Sure. The library consists of a shared folder on the Synology NAS with the appropriate permissions set.

Let’s say I create a new directory. Keeping the web client open in the browser I can see scanning activity within seconds hence the new content is detected.

However if I delete the directory later (via a file manager), it won’t be removed even if I empty the trash. If there were media files in the directory, they would still show up in the library with a status “unavailable”, and then they can be removed manually within the web client (via trash icon), however I see no method to remove the empty directory.

Content removed at a file level used to be removed from the library at the next scan, but this stopped working for me a few months ago. Of course I tried to delete the library altogether and create it again, but nothing has changed.

“Unavailable” is the key.

If you remove too far “up” the tree. PMS will think the media isn’t available.
Consider “USB drives”.

The top level is gone because the drive is unplugged.
Should PMS delete all the content or should it wait?
Marking as unavailable is deliberate. It used to delete blindly. Now it waits until it sees that top-most directory again.

If the top-most (the referenced) directory exists but is empty, THEN it’s ok to delete.

To get out of this, Create that top -most directory and leave it empty.
Let it all scan and remove.
After it’s all gone, Remove the directory from the Library list.
Lastly, remove the directory.

Could You please elaborate?

The library points to DownloadFolder (a shared folder on the NAS). Even if I create an empty folder e.g. DownloadFolder\test, it gets added to the library and I find no way to remove it (won’t be removed after file level deletion). It might be important to point out that I use all of my libraries in Folders view.

Are you having PMS point to an area which contains generally transient folders with movies / tv items under those folders ?