Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 1996 09:57:25 +0200 (MESZ)
From:      "Hr.Ladavac" <lada@ws2301.gud.siemens.co.at>
To:        mrami@mrami.com (Marc Ramirez)
Cc:        andrsn@andrsn.stanford.edu, freebsd-questions@freebsd.org
Subject:   Re: Deleting a Link Farm
Message-ID:  <199607290757.AA245257045@ws2301.gud.siemens.co.at>
In-Reply-To: <Pine.BSF.3.91.960727111633.27813D@boner.mrami.com> from "Marc Ramirez" at Jul 27, 96 11:18:03 am

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607290757.AA245257045>