This is the mail archive of the
mailing list for the Cygwin project.
Re: Feature request: rm to recycle bin
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Sat, 10 May 2008 21:51:22 +0200
- Subject: Re: Feature request: rm to recycle bin
- References: <48258BCC.firstname.lastname@example.org>
- Reply-to: cygwin at cygwin dot com
On May 10 12:49, Stephen Kennedy wrote:
> I've searched the mailing list so believe this isn't a FAQ; apologies if it
> There have been several threads on the mailing list about replicating
> Windows' recycle bin functionality using aliases or shell functions, none
> of which are really satisfactory. However, in this thread
> http://sourceware.org/ml/cygwin/2007-01/msg00327.html it was discussed that
> 'rm' has been patched to send deleted files to the recycle bin in certain
> limited circumstances.
> Given that the code for sending to recycyle bin is already in place, may I
> request that a command line option be added to rm and rmdir to send all
> files to the bin? This would be extremely handy for use in scripts, to me
> at the very least.
The code to move files into the bin is an underlying, hidden feature of
the unlink(2), rmdir(2) and rename(2) POSIX calls. The rm(1) tool has
no access to this functionality and there's no intention to add a
non-POSIX API to allow any tool to use it.
Besides, the files moved to the bin directories by the Cygwin DLL are
always marked for deletion. As soon as the last process closes its
handle to the file, it disappears.
This is not at all what you expect from the recycle bin functionality in
the Explorer GUI. The bin is just a convenient place to move files in
use into, before marking them for deletion. Additionally, even if the
files moved to the bin wouldn't be marked for deletion, Explorer
wouldn't know about them, so you would not be able to revert the
deletion by moving the files out of the bin in Explorer. That requires
additional bookkeeping which is only done in the appropriate Explorer
API. Cygwin OTOH uses native NT functions to implement the
aforementioned POSIX calls.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html