Date: Sat, 19 Jan 2002 11:01:04 +0000 From: Ceri <setantae@submonkey.net> To: "J. S." <johann@broadpark.no> Cc: freebsd-questions@freebsd.org Subject: Re: How to delete only empty directories Message-ID: <20020119110104.GC11503@rhadamanth> In-Reply-To: <20020119111746.7fea5191.johann@broadpark.no> References: <20020119111746.7fea5191.johann@broadpark.no>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 19, 2002 at 11:17:46AM +0100, J. S. wrote:
>
> Now I need to delete those empty directories and _only_ the empty
> directories. Does anyone know how?
>
> I did a "find ./ -type d -empty > ../empties" to at least get control over
> what I need to remove. But it is like several hundred directories and I
> ain't planning on doing it all manually =)
If you're sure that find ./ -type d -empty is giving you the correct list of
what you want to delete, use this :
find ./ -type d -empty -exec rmdir {} \;
If you're not sure (and I would recommend running this initially anyway to
make sure it's deleting what you think) :
find ./ -type d -empty -ok rmdir {} \;
which will ask for confirmation before doing anything.
Ceri
--
keep a mild groove on
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020119110104.GC11503>
