Sample Header Ad - 728x90

How does the trash directory work?

7 votes
1 answer
10873 views
So, I am busy writing myself a program to move and restore items from my trash (recycle bin), currently I can move it to the trash, but if I try to restore it from the trash using a file manager, it fails. The trash directory is located at ~/.local/share/Trash and it has 2 folders inside it, files/ to store the files you want to delete and info/, to store the data about the files. I got the file naming correct in the application, so that is not the problem, and I got the details that gets stored in the info/ folder correct as well. Yet, if I delete something with my file manager and then recover it from the trash, there is no problem, but when I move it to the trash with my code, it can only be recovered by manually moving it... Here are some examples of my application: $ nrash todelete.txt > Moved to trash The above creates this: (inside Trash/files) todelete.txt (inside Trash/info) todelete.txt.trashinfo Inside the **.trashinfo** file, the following resides: [Trash Info] Path=/home/netsu/Documents/todelete.txt DeletionDate=2021-10-08T18:24:04 In a .trashinfo for a file deleted from the filemanager instead, you would find this: [Trash Info] Path=/home/netsu/Documents/pp.txt DeletionDate=2021-10-08T18:25:02 The two are exactly the same, yet don't work the same... Is there something I'm missing about moving things to the trash? Why can the file that was placed there by the file manager be restored, but the one I placed there can not? Is this the universal way the trash works on Linux distros, or does it change depending on distro/desktop environment? Note: My file does appear inside Trash when I open it in the file manager, but I can't restore it. - Distro: Solus - DE: MATE - File Manager: Caja
Asked by Netsu (241 rep)
Oct 8, 2021, 04:59 PM
Last activity: Mar 7, 2025, 01:11 PM