Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 1996 09:47:36 +0200 (MET DST)
From:      grog@lemis.de (Greg Lehey)
To:        compland@ism.com.br (Helio Coelho Jr. - CompuLand Informatica)
Cc:        questions@FreeBSD.org (FreeBSD Questions)
Subject:   Re: Deleting a tree
Message-ID:  <199607090747.JAA09789@allegro.lemis.de>
In-Reply-To: <199607081959.QAA28587@unix1.ism.com.br> from "Helio Coelho Jr. - CompuLand Informatica" at Jul 8, 96 04:59:24 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Helio Coelho Jr. - CompuLand Informatica writes:
>
> Hi Greg:
>
>   Sorry about the confusion. My question is: sometimes you want to
> remove an application you installed. For example: /usr/local/sendmail.
> I want to remove the sub-directory sendmail and all it's contents, without
> going into sendmail, deleting the files and after going into all of the
> subdirectories of sendmail, deleting all the files. I checked rmdir man
> page and seems to me that you only can remove an EMPTY directory. If there is
> a single file inside this directory, you have to go there, delete the file
> first, step out,  and then you can remove the directory. But it sometimes
> is tedious. If the directory has 10 sub-directories inside it, you have to
> remove one by one, by hand! I though of a script, that can recurse into the
> directory you selected and remove the files inside it, and after remove the
> directory itself.

OK.  You don't need a script.  I gave you the answer for that:

  # rm -rf /usr/local/sendmail

The -r option says "recursively descend into subdirectories and delete
them".  The -f option says "don't ask questions".

> I know that, if you remove the directory only, the files will be there,
> in the disk. I wonder if there's a script that can, recursively remove
> all the contents of the directory you selected and any sub-directory it
> might have, and after that remove the directory itself. (Like Deltree,in DOS).
>
>>
>> Whichever it is, you haven't made your request clear.  Do you make a
>> distinction between archives and files?
>
> Yes.

Sorry, this time I didn't make myself clear.  *How* do you distinguish
between archives and files?  In UNIX, an archive is just a special
kind of file.  In this example, I still don't understand.  Are you
referring to the archives you used for installation, outside the trees
you're deleting?  Of course they won't be deleted.

Greg




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