Comment 3 for bug 628561

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote : Re: [Bug 628561] Re: delete should move files to the trash

On Thu, Sep 2, 2010 at 4:48 PM, Martin Pool <email address hidden> wrote:
> On 3 September 2010 01:17, Alexander Belchenko <email address hidden> wrote:
>> The question is: do we have a cross-platform way to delete file into
>> Recycle Bin via Qt/PyQt or Linux/MaxOSX have no idea of trash folder?
>> That said I can find a way to delete to Recycle Bin on Windows using
>> Win32 API, but I don't know how to do it on other OSes.
>
> On Linux and Mac OS X there are standard directories you can move
> things in to, eg ~/.local/shared/trash (I think) on Linux.  I don't
> know if there is a Python API to tell you the location, or to handle
> things not on the home filesystem.

It's not necessarily ~/.local/shared/trash, but $XDG_DATA_HOME/Trash

See the Freedesktop Spec: http://freedesktop.org/wiki/Specifications/trash-spec

PyXDG should work to tell you the location:

http://packages.ubuntu.com/maverick/python-xdg