jump to navigation

No .Trash on External USB Drives September 13, 2006

Posted by Carthik in snippets, ubuntu.
trackback

Nautilus creates a .Trash-xxx directory on external USB drives when you delete something on them. Now this directory will take up space since it has a copy of the files you deleted. You sure can empty the “Trash” on the external USB drive immediately, but if you forget then it can annoy you at random. For example, after deleting all the files from my 256 MB USB drive, I took it to school, and no matter what I did I could not save new photos on the disk, since it was out of space. You may not be able to empty the “Trash” on another computer, especially if you have a different username on that computer. Also, in the past, items in the .Trash folder in external USB drives would cause the trash applet on my panel to show that it had files in it. Right clicking on it and emptying it would not cause the icon to get back to the the “empty” state.

You can fix all this by adding a “Delete” option in Nautilus that straightaway deletes your files without first putting them in the recycle bin (or Trash). After you enable this option, right clicking on a file in nautilus will give you two options “Move to Trash” and “Delete”. I use “Delete” for files on External USB Drives and this then prevents the .Trash-xxx folder from being created on the drives. Here’s how you can enable the “Delete” option. Open Nautilus, then go to the “Edit -> Preferences” option in the top menu. Then in the menu that shows, choose the “Include a Delete command that bypasses Trash”. That’s it, you’ve enabled the delete option.
Enable delete in Nautilus
If you often find yourself looking in Trash for files you have accidently deleted that you suddenly need, then be careful how you delete stuff! After enabling the option, using the “Del” key on the keyboard is a shortcut to move an item to Trash and “Shift + Del” instantly deletes the item without putting it in Trash. Of course, as I said before, for those of you who use the mouse more, right clicking on an item in Nautilus, or the desktop will now show you options for both ways of removing the item.

Comments»

1. Corey - September 14, 2006

Oh *SNAP*! Its not as nice as a solution as I’d like but its a huge improvement. (I’d like an option that just deleted and never used .trash on usb media) This is very cool though. Thanks!

2. Martijn - September 14, 2006

Of course what we REALLY want is for Nautilus to never create the .Trash directories on USB disks in the first place.

Or a way to _replace_ the ‘stupid delete’ with the ‘real man delete’ instead of adding it to the menu.

3. ubuntonista - September 14, 2006

Yes, a “real man delete” replacement, and no .Trash-on-usb-drives would be absolutely awesome – as in – the day it turns out nautilus has these, I will stare at it in absolute awe, jaw open, with a prayer of thanks on my mind 😉

GNOME is for optimists, who believe in the inherent tendency in humans to aspire for incremental improvements. Someday we’ll have it, I know 🙂

4. -E- - September 14, 2006

Well if Nautilus had an option to avoid thumbnails on USB media too it would be great.

5. Cristiano - September 14, 2006

Shift-delete works even without enabling that option “include a Delete command…”

I think i’ll just report a bug to nautilus: please stop creating .Trash on usb drives 🙂

6. #define __JA__ » Blog Archives » Gdzie ja tam i śmieci moje - September 14, 2006

[…] W blogu Ubuntu ktoś poruszył sprawę tworzenia przez Nautilus koszy na dyskach przenośnych. […]

7. Daniel d'Andrada T. de Carvalho - September 14, 2006

Man, that issue really annoyed me a couple of times.
Even though I already know about the .Trash thing, sometimes I just don’t recall about it, mainly when I’m in a hurry. What a nuisance…

This thing can really kill the experience of an average-joe user.

8. Another Know-It-All - September 14, 2006

I have switched several not that technical people to linux (mostly teenager though). And the first time I explained to them what they had to do to delete and why what they did didn’t work, they looked at me like, “you’re kidding right?” ..

The one time I explained it to a technical person that had little linux experience, he responded: “ehm, so it’s trashing my Flash disk. It’s not like a diskette or a harddisk. There are a finitite amount of writes possible of flash and you don’t need to programs creating temporary files there. This makes you flash-drive last about 50% of the time it would normally last.”

To compare to what windows does: It tells you, it can’t go to the recycle bin (i.e. the trashcan) and it asks you if you want to permantly delete the file.

Linux doesn’t even do this for very large files on your harddisk (it should!)

If I delete 10 ISO’s i don’t do that to clean up .. i need the ROOM.

So the trash-logic definately needs some tweaks. Are they comming in Edgy? Thanks for blogging about it though. Reading I feel silly I never put a bug report/feature request about this isssues. Guess I’m expecting stubborness to be the issue. Everyone knows these conventions. (no trash on disks/rewriteable cds/flashdisks/networkdisks or for large files on you harddrive).

9. Another Know-It-All - September 14, 2006

Now we’re on to this issues. I have another user-infriendly-why-linux-is-not-succeeding-type-of-bug.

CD’s burned in Windows with non-asciee characters in them (i.e. about half the files not from americans) are not readable in linux because the cd is not mounted with the jolliet extensions.

I had to turn this on for everyone I know that works with Ubuntu, because they complain about it. It’s one of those -still requires the command line thingies- whereas it could just be set to the _right defaut_. Joliet extensions does not hurt reading cd’s burned in Linux or a Mac. But it does make CD’s burned with say Nero on Windows _readable_. I mean, you can open the files. But the filenames are wrong. Many programs refuse to play them. And you can’t burn them again or put them on a usbdisk.

10. Johannes - September 14, 2006

I knew this solution but it’s bad!

Nautilus should not create a Trash on USB-Discs at all but keep the deleted files somewhere on your harddrive (at your choice).

Gonna file a bug…

11. Kernel Source » Borrar sin madar a la papelera en dispositivos de almacenamiento externos - September 14, 2006

[…] Por defecto, cuando eliminamos desde Nautilus archivos de nuestro pendrive (o memoria externa), éste nos lo manda a la papelera (carpeta .trash-usuario dentro del mismo pendrive) con el consiguiente consumo de espacio en el dispositivo. Vía Ubuntu Blog nos llega un sencillo truco a través del cual podremos eliminar los archivos que no necesitemos de forma limpia, sin desplazarlos a la papelera y liberando el correspondiente espacio en la unidad. […]

12. skarulis.com » Blog Archive » Using F-Spot to import from a USB attached memory card AND how to make sure those files are deleted - September 14, 2006

[…] Viola!  Now, when I insert my SD camera card into my pc, f-spot asks me whether I want to import the photos.  As long as I keep the default option of “Copy files to the Photos folder” selected, it will actually copy them to the /mnt/linkstation/Pictures.  It also uses a nice convention of using and or creating subfolders based upon the year and month that the pictures were taken, which makes the “physical” organization of the photos nice and straightforward. So, now that we’ve got f-spot importing the photo files the way we would like, there is one remaining issue: how to delete them from the memory card.  F-spot does not provide an option to delete the originals from the source when copying/importing.  So, I wind up opening nautilus and deleting them manually.  But wait, why is it that the memory on the card isn’t freed up just yet??  Well, it turns out that instead of simply deleting the files, nautilus creates a trash directory (on the card) to which the files are transfered.  Under this scenario, to make sure the card is emptied, I have to always remember to empty the trash on the card.  That was the process, that is until today.  Thanks to Ubuntonista at Ubuntu Blog for this post on how to enable nautilus to delete files without sending them to trash.  So now, by configuring nautilus to offer an additional option of doing a pure delete rather than moving to trash, I simply right click the files I want to blast from the card within nautilus, select “Delete” rather than “Move to Trash”, and its done. […]

13. Cristiano - September 15, 2006

I’ve discovered that the bug was already reported on ubuntu launchpad and gnome bugzilla:

https://launchpad.net/distros/ubuntu/+source/nautilus/+bug/12893

http://bugzilla.gnome.org/show_bug.cgi?id=138058

But it seems it will take a time before it gets fixed.

14. Limulus - September 15, 2006

Thanks for the tip; this is very handy when running sudo nautilus too 🙂

Also, when doing that, go Edit -> Backgrounds and Elements… and you can make the sudo nautilus window a different color/background from the normal nautilus

15. Jan Wikholm - September 15, 2006

Thank you for this tip! Prior to this I always had to open up a gnome-terminal and do `rm -fr /media/usbdisk/*` and now I can do it all from Nautilus.

Cheers.

16. links for 2006-09-16 « kobak del.icio.us könyvjelzői - September 16, 2006

[…] No .Trash on External USB Drives « Ubuntu Blog ne kelljen kezzel torolni a .Trasht, ha esetleg nautilusban toroltem valamit. (tags: ubuntu reference howto) […]

17. chip - September 18, 2006

Just in case you did not know, when running the ubuntu breezy/edgy liveCD the trash applet does not work. This has been bugging me for awhile.

Boot the desktop (liveCD) and drop a few things into the trashcan, it will say that it is empty, it will not allow you to empty the trash even though there is trash in the .Trash file.

18. Getting Ubuntu To Take Out the Trash on USB Drives « dreaming spires - September 20, 2006

[…] Check out the fix here. […]

19. Wildcat0695 - September 21, 2006

Thanks, I needed this.

20. Sionide - September 29, 2006

I’ve just changed the permissions on my Trash directory on my USB stick so it’s actually impossible for stuff to be put there – hence I’m forced to remember to properly delete it using the method above. That works well enough for the time being anyway..

21. Siddhartha - August 21, 2007

Hi,
I already have .Trash- directory created on my usbdrive. Now I want to delete it using the same userid from my RHEL 4 linux machine.
It is giving me “Read-only file system” error the status is drwxr-xr-x for that .Trash- directory.
Could anyone help me out?
Cheers,
Sid

22. Mighty Linuxz » No .Trash on External USB Drives with Nautilus - November 7, 2007

[…] read more | digg story […]

23. mark - April 10, 2010

I fucking love this

24. dee - June 22, 2010

Creating an empty file (not a folder) named “.Trash-1000” seems to put a stop to it.

25. sikiş izle - September 26, 2010

Well if Nautilus had an option to avoid thumbnails on USB media too it would be great.

26. antalya ilaçlama - September 27, 2010

I’ve just changed the permissions on my Trash directory on my USB stick so it’s actually impossible for stuff to be put there – hence I’m forced to remember to properly delete it using the method above. That works well enough for the time being anyway..

27. porno sikiş - September 27, 2010

Man, that issue really annoyed me a couple of times.

28. sex sikiş - September 28, 2010

To compare to what windows does: It tells you, it can’t go to the recycle bin (i.e. the trashcan) and it asks you if you want to permantly delete the file.

29. secrets.lk - June 30, 2014

Great website. A lot of useful information here.
I’m sending it to a few buddies ans also sharing in delicious.

And obviously, thanks on your sweat!

30. Claudio - November 15, 2016

And there is another problem with that auto-created folders.

Some TV’s, Set Top boxes, Media players, refuse to read a media that have “any” folder on its root (supporting FAT32 and NTFS), if there is any folder, the media is seen as not-valid media.

Other act worst, they try to read and find such ‘.’ starting character and miss, crassing… i saw a TV showing a window telling you must power off the TV to continue (same concept as Windows BSOD), so you must unplug power cord from the wall (it has no power swicth, only stand-by).

Why on the hell they create such folders?

For FAT (any size, FAT/FAT12/FAT32/vFAT/exFAT) there is a way to ‘hide’ filenames and folders (putting a special character as first character) it came from old 70’s DOS system, it is to mark a file (or folder) as deleted but recoverable, it was implemented quite bad (when you remove it, the first letter was changed to that special char, loosing it, think what would happend if it would be added… same problem, it was a limit of 8.3 characters, but on time when vFat enter in the game, that limit goes away… they did not change such way of doing it), why on the hell the trash can not use such technique?

For NTFS (nto so many people know it) there are some special files on the root of any NTFS partition ($MFT, $MFTMirr, $LogFile, $Volume, $AttrDef, $BitMap, $Boot, $BadClus, $Secure, $UpCase, $Extend, $ATTRIBUTE_LIST, and a large etc), that ones are not visible on any TV, SetTopBox, etc… they are hidden by the NTFS driver, so why on the hell they do not use the same technique to hide $GetCurrent, $Recycle.Bin, “System Volume Information” and so on…

For Ext#, there is a ‘.’ starting character that is to mark a file or folder as hidden, but there is also the posibility to have files and folders with no name (Length=0), that ones are accessed by it’s iNode, etc… not by name, why on the hell the trash can not use such technique?

The only answers i can think of are: they are too lazy or they want to (sorry for the term) f.u.c.k all of us.

If i use an External media for documents, etc… it is correct to have a trash… but if i use it to store (Photos maded by a Camera) (Videos recorder by a video-cam) (BackUPs in 7z format LZMA2, or any other compression technique, Pismo file mount files, VeraCrypt containers, etc) there is no reason to have a trash.

So, as is done on Android (with .nomedia file), use an empty file called ‘.noTrash’ on root, so OS can see user do not want Trash on that media… or use any of the techniques that the filesystems have (FAT, NTFS, Ext#, others types i do not manage them, so i can not know if they have any other way).

If developers are so Lazy to not use each existant system techniques to hide the Trash, let them be more Lazy and use a ‘Flag’, an empty file (like .NoTrash) on the root.

Something must be really hidden on the actuation of Windows and Linux developers… they want to spit our balls (sory for the terms, they try to express what i feel when people do things without thinking in other devices) so what is the reason to do things so badly and not user friendly?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: