Prevent Nautilus / Nemo from creating .Trash-1000 folder in mounted devices

Both Nautilus and Nemo create hidden folders called .Trash-1000 in any mounted device, apparently to manage their Trash folder. This is mighty confusing in network drives that are mounted by other users, that may be using other operating systems or programmes that do not recognise this folder as a trash bin.

Moreover, this folder expands with the number of files deleted and can not be erased from Ubuntu:

$ sudo rm -rf ./.Trash-1000
rm: cannot remove './.Trash-1000/files': Directory not empty

To free space in such mounted volumes the .Trash-1000 folder must be deleted from a different system.

Is there any way to prevent Nemo or Nautilus from creating this folder in network drives? I can naturally simply not use them, but they are handy in many situations.


Solution 1:

After looking at Nautilus's source code and Michael Stumpfl's answer it becomes clear that trash folder creation, is something hard-coded in Nautilus's source code itself and is part of how libgio works - the library behind file manipulations in Gtk/GNOME applications. Therefore disabling such behavior is currently not possible without recompiling either the file manager itself or altering source code of the library ( which I wouldn't recommend doing, since other applications rely on it, so changes may affect other applications' behavior ).

Probably the best solution is to propose a feature request to Nautilus developers and wait until it is fixed. One could also resort to permanent deletion of files via Shift+Delete short cut or using command-line utilities such as mv (move to user's trash folder on / filesystem) or rm. Otherwise - switch to using different file manager for the time being.