Survey -- Move To Trash function in Python?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu May 14 22:03:19 EDT 2015


On Fri, 15 May 2015 03:32 am, Dave Farrance wrote:

> Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
> 
>>I'd like to do a little survey, and get a quick show of hands.
>>
>>How many people have written GUI or text-based applications or scripts
>>where a "Move file to trash" function would be useful?
>>
>>Would you like to see that in the standard library, even if it meant that
>>the library had feature-freeze and could gain no more functionality?
> 
> It's bad enough when things are filesystem-dependent but this is
> OS-dependent or even desktop-version-dependent in the case of Linux
> distros, so not easy.
> 
> E.g. in the case of KDE4, the command-line is:
> $ kioclient move <filename> trash:/
> 
> ...and for KDE3 it was:
> $ kfmclient  move <filename> trash:/


I'm not sure if you intend that as a vote in favour or against the idea :-)


The idea is that the library will hide that complexity from you, so your
python code will just say:

import shutil
shutil.move_to_trash(filename)


and it will work on any supported OS, filesystem and desktop.



-- 
Steven




More information about the Python-list mailing list