6

I have a 32 GB USB flash drive. When deleting files from the drive where the drive is plugged into a Ubuntu 16 laptop, it creates a folder called '.Trash-1000'

This .Trash-1000 folder contains two folders which are 'file' and 'info' where file contains the files I have deleted and info contains metadata about those files.

The issue is this .Trash-1000 folder takes up space because it holds a copy of the deleted file. I then have to eventually delete the .Trash-1000 folder when it starts filing up after multiple deletes.

Is there a way to disable this feature on the USB drive?

  • How are you deleting the files? – jasonwryan Jul 1 '17 at 20:59
  • Through the Ubuntu GUI. Could that be the issue? – William Ross Jul 1 '17 at 21:46
  • Yes; it is moving the files to Trash, not deleting them. Use rm. – jasonwryan Jul 1 '17 at 21:52
7

Have a look at this article.

According to the article, Ubuntu will create such folders when a file is deleted from a USB drive. Presumably this would allow a file to be restored if you accidentally deleted it.

It contains the following solution:

Don't use the delete button only (Otherwise the .Trash-1000 folder will be created)

Press the key combination shift+delete together to delete then Ubuntu won't create a .Trash-1000 folder. (Note: If you delete files and folders this way they are gone forever!)

As alternative you can also use the command line's rm command which will also delete the file directly.

  • Nice, that solution of doing shift+delete does not create the .Trash-1000 folder. Also I realized if open a terminal at the USB location and do an rm command, it does not create the .Trash-1000 folder either. – William Ross Jul 2 '17 at 1:59
6

I have found an interesting workaround that works on a per device basis, tested on Xubuntu 18.10 with USB devices and EncFS mounts.

It's very simple, remove the desired .Trash-$(id -u) directory (id -u is most commonly 1000), and create a file instead with the same name:

rm -rf /path/to/.Trash-1000
touch /path/to/.Trash-1000

What happens now when you remove a file, at least with Thunar, is that instead of moving the files to the Trash, a dialog appears warning you the files will be destroyed (which is awesome too, since you don't want them destroyed by accident).

1

I too am one of those who have been bugged by this problem for a number of years ... unsatisfied with the existing proposals, I've recently taken the time to investigate a solution myself.

Starting with the premise that I want the Trash to be gone system-wide, I've found that -- for the time being -- the only real solution is to create a custom-compiled version of libgioGIO) which is modified to call g_file_delete() every time an application calls g_file_trash().

For all technology savvy users interested in this solution: I've just recently posted a step-by-step guide on GitHub:

Globally disable GNOME's Trash in Debian-based distributions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.