Date: Wed, 11 Apr 2007 14:13:59 -0400 From: Bill Moran <wmoran@potentialtech.com> To: deeptech71@gmail.com Cc: Pieter de Goeje <pieter@degoeje.nl>, freebsd-questions@freebsd.org Subject: Re: rm --clear-directory /home/me/another_dir 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070411141359.c9ba203b.wmoran>