Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 2020 14:41:14 +0100
From:      Michael Schuster <michaelsprivate@gmail.com>
To:        Karl Denninger <karl@denninger.net>
Cc:        freeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Removal script
Message-ID:  <CADqw_gKjOSzoyKaWToxcfz9-5e+1QtEN1dFO5MfGjnKYib8maA@mail.gmail.com>
In-Reply-To: <792c5f22-5851-7419-f9a1-fa40df265f1c@denninger.net>
References:  <24af365c-bfab-b5ac-72e3-675b0450b75f@cloudzeeland.nl> <792c5f22-5851-7419-f9a1-fa40df265f1c@denninger.net>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
I would suggest

find /mysources - type d -name nonsense ...

HTH
Michael

On Sat, Feb 15, 2020, 14:36 Karl Denninger <karl@denninger.net> wrote:

>
> On 2/15/2020 07:31, Jos Chrispijn wrote:
> > I am looking for a way to remove a nested subdirectory in a directory.
> >
> > Example:
> > directory /mysources has a certain number of subdirectories which
> > contain subdirectory 'nonsense' in various subdirectories, which
> > contain also subdirectory 'nonsense', etc.
> >
> > What I would like to do is that the script removes all 'nonsense'
> > folders in the base /mysources.
> > Can you pls tell me how I can do that savest? Thanks!
> >
> > /jos
>
> Well, there's no completely "safe" way that might not nuke something you
> don't intend, but....
>
> find . -type d -name 'nonsense' -exec rm -rf {} \;
>
> Starts in the current directory, walks the tree, anything that is a
> directory and has the name "nonsense" is "rm -rf'd".
>
> Just don't be wrong about any of those directories being or having in
> them something you don't want nuked.  "rm -rf" does exactly what you
> tell it to and it's entirely possible to really hose yourself with it
> (e.g. "rm -rf /" will do exactly what you think it might.)
>
> --
> Karl Denninger
> karl@denninger.net <mailto:karl@denninger.net>
> /The Market Ticker/
> /[S/MIME encrypted email preferred]/
>



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?CADqw_gKjOSzoyKaWToxcfz9-5e+1QtEN1dFO5MfGjnKYib8maA>