From owner-freebsd-questions Mon Jul 29 01:04:34 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id BAA11339 for questions-outgoing; Mon, 29 Jul 1996 01:04:34 -0700 (PDT) Received: from news.siemens.at (news.siemens.at [192.138.228.18]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id BAA11326 for ; Mon, 29 Jul 1996 01:04:28 -0700 (PDT) Received: from sol1.gud.siemens.co.at (sol-f.gud.siemens-austria) by news.siemens.at with SMTP id AA18056 (5.67a/IDA-1.5 for ); Mon, 29 Jul 1996 10:03:52 +0200 Received: from ws2301.gud.siemens.co.at by sol1.gud.siemens.co.at with smtp (Smail3.1.28.1 #7 for ) id m0uknF5-000226C; Mon, 29 Jul 96 09:59 MET DST Received: by ws2301.gud.siemens.co.at (1.37.109.16/1.37) id AA245257045; Mon, 29 Jul 1996 09:57:25 +0200 From: "Hr.Ladavac" Message-Id: <199607290757.AA245257045@ws2301.gud.siemens.co.at> Subject: Re: Deleting a Link Farm To: mrami@mrami.com (Marc Ramirez) Date: Mon, 29 Jul 1996 09:57:25 +0200 (MESZ) Cc: andrsn@andrsn.stanford.edu, freebsd-questions@freebsd.org In-Reply-To: from "Marc Ramirez" at Jul 27, 96 11:18:03 am X-Mailer: ELM [version 2.4 PL24 ME8a] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk In his e-mail Marc Ramirez wrote: > On Sat, 27 Jul 1996, Annelise Anderson wrote: > > > I've had /usr/ports linked to /cdrom/ports with lndir; in addition to > > the symbolic links, quite a few regular files also existed in various > > directories. > > > > I couldn't find any direct way to remove the links lndir created, so > > I used find to find symbolic links and remove them, then found the > > regular files and moved them, and finally used rm -R to get rid of > > all the empty directories. > > > > Is there an easier way, or a way to remove only empty directories and > > leave those with regular files? > > find /usr/ports -type l -exec rm {} \; > > will delete all symbolic links. And will take forever. But Annelise already did that. find /usr/ports -type l -print | xargs rm is much faster and gets rid of links. find /usr/ports -type d -depth -print | xargs rmdir should get rid of empty directories. You can play with redirecting stderr into oblivion if you do not wish to see "blah is not empty" zillions of times. /Marino