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 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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/