Every now and then I run into the weird behavior that when I want to remove but not delete (=send to trash/recycle bin) files or folders, it doesn't work: I'm forced to either let it be or remove it completely.
This short HowTo is about how to enable local trash folders on different harddisks.
A short peek into The FreeDesktop.org Trash specification (v1.0, January 2014) revealed that this should be possible. Excellent!
If a certain folder exists on mounted drives, it will be used as preferred trash folder for that medium (to avoid having to copy/move files to the trash folder in the user's home directory).
A trash folder per drive.
On each disk where you want to be able to trash stuff, you have 2 options for a trash folder:
- .Trash/$UID
- .Trash-$UID
I prefer the common .Trash folder with subdirectories per $UID.
1) Create ".Trash"
As root:
Code: Select all
$ mkdir $NEW_DRIVE/.Trash
$ chmod 777 $NEW_DRIVE/.Trash
$ chmod +t $NEW_DRIVE/.Trash
btw: (X)ubuntu usually creates ".Trash-$UID" folders, resulting in ".Trash-1000" or ".Trash-1001", etc folders on external harddisks.
The FreeDesktop.org Trash specification mentions that as 2nd option:
(2) If an $topdir/.Trash directory is absent, an $topdir/.Trash-$uid directory is to be used as the user's trash directory for this device/partition. $uid is the user's numeric identifier.
2) Manually trash a file using "gio"
I expected Thunar to create the $UID subfolder once I have a .Trash folder in root. It doesn't.
Code: Select all
$ gio trash delme.txt
From now on, Thunar also uses the new trash option.
Voila!
Not helpful here, but fun to read: Blog about trash management in XFCE (2004)