Trash

Sam Morris sam at robots.org.uk
Thu Dec 1 15:01:17 GMT 2005


James Livingston wrote:
>>> Moving files to ~/.Trash when they get sent to the trash wouldn't
>>> be a good idea here, because they are potentially multi-gigabyte
>>> files which a) would be slow, and b) the files may not even fit
>>> on my /home partition.
>> 
>> On the other hand, for media with limited size, usb sticks, zip
>> drives, floppies, ipod-thingy's, etc a .trash folder is cumbersome
>> and annoying. In my use case, I copy my.~/documents folder and drag
>> it along on a 128mb drive. Should fit fine, save for the fact that
>> every time I delete something, it sticks around in .trash, which is
>> very unintuitive for me, so I only find out about it when some
>> program complains the drive is full.
> 
> I see where you're coming from, but I don't know how we could get it
> to work nicely, without causing problems for large files or network
> mounts.
> 
> Consider having a 128Mb flash mp3 player and a 60Gb mp3 player. For
> the former moving to ~/.Trash would probably work, for the latter it 
> wouldn't. Behaving differently for different size media would be 
> horrible, because users wouldn't know what it will do when they plug
> in a random device.

Isn't there a freedesktop.org trash specification that explains how to
handle stuff like this? <http://www.ramendik.ru/docs/trashspec.html> is
the best page I can find:

> The implementation MAY also support trashing files from the rest of
> the system (including other partitions, shared network resources, and
> removable devices) into the “home trash” directory . This is a
> “failsafe” method: trashing works for all file locations, the user
> can not fill up any space except the home directory, and as other
> users generally do not have access to it, no security issues arise.
> 
> However, this solution leads to costly file copying (between
> partitions, over the network, from a removable device, etc.) A delay
> instead of a quick “delete” operation can be unpleasant to users.
> 
> An implementation may choose not to support trashing in some of these
> cases (notably on network resources and removable devices). This is
> what some well known operating systems do.
> 
> It may also choose to provide trashing in the “top directories” of
> some or all mounted resources. This trashing is done in two ways,
> described below as (1) and (2).

Where (1) describes a sticky .Trash directory at the top level of a 
mounted filesystem, where trashing a file creates (and moves the file in 
question to) /media/foo/.Trash/$user; and where (2) describes on-the-fly 
creation of (and moving the file in question to) /media/bar/.Trash-$user.

Since you (likely) have write access to your 60 GB mp3 player at 
/media/usbdisk, a trashed file would be moved to 
/media/usbdisk/.Trash-james.

In fact this is what Nautilus seemed to do on a system running Breezy 
when I deleted some folders on my brother's mp3 player. We spent a while 
wondering where the 4 GB of space had gone before he noticed the 
.Trash-sam folder containing the 'deleted' files. :)

-- 
Sam Morris
http://robots.org.uk/

PGP key id 5EA01078
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078




More information about the ubuntu-devel mailing list