From owner-freebsd-questions@FreeBSD.ORG Wed Apr 11 18:14:01 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B01E416A40A for ; Wed, 11 Apr 2007 18:14:01 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from mail.potentialtech.com (internet.potentialtech.com [66.167.251.6]) by mx1.freebsd.org (Postfix) with ESMTP id 8866113C4BF for ; Wed, 11 Apr 2007 18:14:01 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from vanquish.pgh.priv.collaborativefusion.com (pr40.pitbpa0.pub.collaborativefusion.com [206.210.89.202]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.potentialtech.com (Postfix) with ESMTP id CAE81EBC76; Wed, 11 Apr 2007 14:14:00 -0400 (EDT) Date: Wed, 11 Apr 2007 14:13:59 -0400 From: Bill Moran To: deeptech71@gmail.com Message-Id: <20070411141359.c9ba203b.wmoran@potentialtech.com> In-Reply-To: <461D24EF.2050507@gmail.com> References: <461D0614.2060709@gmail.com> <200704111849.08117.pieter@degoeje.nl> <461D24EF.2050507@gmail.com> X-Mailer: Sylpheed 2.3.1 (GTK+ 2.10.11; i386-portbld-freebsd6.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Pieter de Goeje , freebsd-questions@freebsd.org Subject: Re: rm --clear-directory /home/me/another_dir X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2007 18:14:01 -0000 In response to deeptech71@gmail.com: > Pieter de Goeje wrote: > > On Wednesday 11 April 2007, deeptech71@gmail.com wrote: > >> Is there a way to clear a directory with such a command (keeping the owner > >> and permissions of the folder)? > >> > >> Yes there are the obvious ones: > >> cd /home/me/another_dir && rm * > >> rm /home/me/another_dir/* // if cant traverse here > >> > >> But something that doesn't rely on the shell. > > cd /some/dir && find . -delete > > > > Cheers, Pieter > > > > Well, IMO, for aesthetical and logical purposes, /some/dir should point to the > directory, and /some/dir/ should point to the inside of the directory (as in > copy INTO or FROM). So: > > # cp /one /two/ // this copies dir one into dir two, so there will be a dir > named /one/two after this command > > # cp /one/ /two/ > ==> Do you want to recursively overwrite contents of dir /two with the content > of dir /one ? [n] y > > # cp /one /two > ==> Do you want to recursively overwrite /two with /one ? [n] y > > # cp /one/ /two > cp: error - overwrite a dir with some other contents? WTF? > > oh and of course: > rm -R /dir // removes dir > rm -R /dir/ // clears dir > > > How hard will it be to convince the developers to swich to this scheme? since > all scripts will have to be reworked... All you have to do is change the POSIX standards and everyone will follow. -- Bill Moran http://www.potentialtech.com