Where does Plex move deleted files to on Ubuntu?

Server Version#: 1.23.0.4497
Player Version#: 1.31.1.2262

I have recently migrated my Plex server from my main Windows 10 development workstation to a VM running Ubuntu 20.04.

I’ve assigned it a good amount of RAM and several cores and everything appears to be working well and I am pretty pleased that I was able to keep all my library data and even the DVR schedule :wink:

When the server was running on Windows and I deleted a TV show or duplicate MP3 file, from either Plex for Windows or the the Plex Tizen client, for example, the file would end up in the Recycle Bin.

As I understand it, on Ubuntu, the file should be moved to the Trash folder - but where is this?

I have checked for the existence of this folder in the follow locations but to no avail:

/root/.local/share
/home/steve/.local/share

Sorry if this sounds like a newbie question - even though I’ve been using Linux professionally for about 6 years now, so I’m quite happy developing software on it, I still don’t know where various file locations are :frowning:

I’ve also tried searching the forums here as well as searching the web but cannot find the answer - would someone be so kind to enlighten me please?

By default, Linux does not have a trash bin. Every delete is immediate and permanent.

Certain Desktop managers support an artificial Trash bin , where the files are moved to, until permanently deleted.

Should you open the command line, and type rm filename (remove), the action is immediate and permanent. Programs, such as Plex, also use the rm() system call which is again immediate and permanent.

This is the nature of Linux.

Surely you mean unlink()… :smiley:

1 Like

:stuck_out_tongue: :man_facepalming:

Yes.

@ChuckPa

Ive seen when deleting a media in plex , only the mkv is deleted and not the rest of the files in the folder? Even the folder isnt deleted, is that on purpose? Rather annoying tbh :slight_smile: :adhesive_bandage:

Yes, Plex is very ( sometimes too ) surgical in deleting.

It does this because the primary use is for DVR where just the video files are collected.

When you are done watching a recording, you typically delete it, right?

I, for one, don’t want it to delete from my main library of curated media with all its extras I’ve ripped.

If the media file is the only file in the folder, then the file and folder are both deleted. If there are other files in the folder then only the media file is deleted.

Like, for instance, a subtitle file - unique to THAT ITEM and works with NOTHING ELSE… Plex leaves that and it’s folder as CLUTTER.

Clutter doesn’t matter to Plex.
Apparently.

I too would prefer that Plex delete the folder and all its contents. This would save me the effort of locating the clutter and deleting by hand. Maybe if someone made a feature request?

I saw an employee once say, years ago, Plex could clean up after itself better and they were going to investigate the possibilities. Unknown how that investigation went 'cause that guy was never heard from again.

If I use the UI to delete an item with Extras and the Extras disappear - that’s on me 'cause I clicked the button that says ‘Delete’. Now when I click Delete - I have to go find and Delete all the stuff Plex didn’t.

Since there’s no way to alter the timing of a subtitle, unless it’s external, many of us have external sub files. Since Movies and their subs need to be in Folders the ‘Delete’ button is useless if Clutter isn’t something you enjoy.

… and if I was using Ubuntu (or something else that has no recycle bin) - I’d sure set up a buffer zone between the Delete button and the Black Hole at the Center of the Plexiverse - 'cause NOTHING can escape that - not even light.

Cheers - that makes sense.

Similar to Windows - del filename at the command prompt won’t move the file to the recycle bin out of the box/without installing third party products.

I’m guessing Plex is using the ShellAPI extensions, such as SHFileOperation() , to do this rather than unlink() or DeleteFile() and conditionally compiling it in on Windows :wink:

Plex uses the programming API (glibc on linux).

A trash can is implemented by the rename() function call.
(which moves the file from one directory to another – the .Trash directory)

Emptying the trash uses unlink() to hard delete the file.

I thought you said above that a trash can is not supported by default, implying that Plex does not use it?

If that isn’t the case could you please enlighten me as to where the .trash directory is and how I get Plex to use it?

Thank you.

That’s correct. Plex uses glibc (the Linux C library) directly.

File Managers (Nautilus, etc) are what implement trash cans.
File Managers create the artificial construct “Trash Can” and provide you this on their menus and attach “Move to Trash” with the “Del” key in some cases.
The File Manager also uses glibc() to rename() and unlink().

Files are moved by the File Manager using rename() to the trash
Files are then hard deleted using the unlink()

See how the File Manager (GUI) is a full layer above where Plex operates at ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.