[New-bugs-announce] [issue24185] Add Function for Sending File to Trash (or Recycling Bin)

Taylor Marks report at bugs.python.org
Thu May 14 05:36:41 CEST 2015

New submission from Taylor Marks:

When you have a file that you don't think you need anymore, the proper thing to do with it is move it to the Trash (or Recycling Bin, if you're on Windows.)

The standard library, however, doesn't offer any way of doing this currently. Instead, the only thing it offers is the ability to delete files. Deleting files is a potentially dangerous operation. A novice programmer may end up carelessly delete the wrong file.

I would suggest adding in a new function which allows for cross-platform moving of files to trash. It could go into the existing shutil or os modules. Or it could get its own module (like glob).

It could be based upon (or even be exactly) this implementation:

Afterwards, the docs for os.remove and shutil.rmtree could have a warning added that suggests that instead of using such dangerous functions, it may be best for the user to use the new function.

(If this is not the place to propose additions to the standard library, please redirect me for where I should go instead. PEP 5 covers how the language should evolve, but then only has a link to bugs.python.org.)

components: Library (Lib)
messages: 243149
nosy: Taylor.Marks
priority: normal
severity: normal
status: open
title: Add Function for Sending File to Trash (or Recycling Bin)
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list