When you delete media files from your Plex server, the media item associated with those files will still be showing in Plex. This is because Plex doesn't delete information associated with deleted media immediately. To remove information for media files that have been deleted the empty trash command will need to be run.
Emptying the trash from your Plex server is one of the steps in the Plex Dance to reset a library on your server.
The next section explains the steps involved in emptying the trash on your Plex server.
Table of contents
- How to empty the trash
- The step-by-step guide for running the empty trash option from the Plex Web app.
- How to empty the trash for a library
- The step-by-step guide for running the empty trash option for a single library.
- Automatically emptying the trash in Plex
- Step-by-step instructions for automatically emptying the trash command to run on a scan in Plex.
- Running empty trash on-demand
- Discusses how you can run the clean bundles command at any time without using the Plex Web app.
How to empty the trash
Plex stores information about all the media it manages on either the file system in a data directory or in the Plex database. Each time Plex scans a library, it downloads and stores the media metadata information.
When files associated with an item are deleted from the file system, Plex won't delete the metadata information immediately. The empty trash command will need to be run on the server to clean up any information that is no longer associated with a media item.
Emptying the trash in Plex is usually quick and easy, depending on how much information needs to be cleaned from the server. To empty the trash in Plex, do the following:
- From Plex, click the More link.
- Move your mouse cursor over your server name from the menu on left. Click the three dots that appear, and then select Manage Server->Empty from the menu that appears.
- Click the Empty button.
Once the above steps have been completed, any information for all deleted media files will be removed from Plex.
How to empty the trash for a library
Plex provides a way to empty the trash for a specific library. This option is available if you delete files that are associated with one library. By only emptying the trash for a library, you prevent Plex from accidentally deleting information for other libraries unnecessarily.
Emptying the trash for a single library is very similar to emptying the trash for the entire server. The following steps explain how to empty the trash for a single library:
- Move your mouse cursor over the library name from the menu on left. Click the three dots that appear, and then select Manage Server->Empty from the menu that appears.
- Click the Empty button.
Automatically emptying the trash in Plex
You can have Plex automatically run the empty trash command whenever it performs a scan on media items. This means that if Plex detects a media item in a library no longer has any files associated with it, the information for the media item is deleted.
I don't recommend you enable this option for one reason: Plex can accidentally delete information for media items that aren't really deleted.
What I mean by that is if you store the media files on a different device than your Plex server, such as a NAS or external hard drive, that device can become disconnected from the server. If Plex scans the libraries when the device is disconnected, then Plex will flag those media files from the disconnected device as deleted. Plex will then run the empty trash command, which will delete the information associated with the disconnected media items.
If you wish to have Plex automatically run the empty trash command after every scan, then you can use the following steps:
- Open a Web browser and navigate to your Plex server.
- Log into your Plex server with an administrator account.
- Click the Settings icon - the wrench - in the upper-right corner of the Plex server page.
- On the left menu, click the Library option under the Settings section.
- Check the Empty trash automatically after every scan option.
- Click the Save Changes button at the bottom of the page to save your changes.
The above steps will have Plex empty the trash after it has performed a scan.
Running empty trash on-demand
When the empty trash option is run, whether from the Plex Web app or the scheduler, Plex calls its API command to empty the trash. You can also run the empty trash API command anytime to clean up your Plex server whenever you wish.
While it is good to periodically empty the trash on your Plex server to clean out old, unneeded data from Plex, you must be careful when you do run the command to avoid deleting too much information from Plex.