delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/05/10/15:51:56

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Sat, 10 May 2008 21:51:22 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Feature request: rm to recycle bin
Message-ID: <20080510195121.GM18799@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <48258BCC DOT 9090905 AT sdkennedy DOT com>
MIME-Version: 1.0
In-Reply-To: <48258BCC.9090905@sdkennedy.com>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list 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 
> 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 
> 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

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019