This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Feature request: rm to recycle bin

On May 10 12:49, Stephen Kennedy wrote:
> I've searched the mailing list so believe this isn't a FAQ; apologies if it 
> is.
> 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 
> 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
Red Hat

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]