Date: Sat, 15 Feb 2020 13:41:55 +0000 From: Steve O'Hara-Smith <steve@sohara.org> To: freebsd-questions@freebsd.org Subject: Re: Removal script Message-ID: <20200215134155.6f8e6f901c9175dbdbef7808@sohara.org> In-Reply-To: <24af365c-bfab-b5ac-72e3-675b0450b75f@cloudzeeland.nl> References: <24af365c-bfab-b5ac-72e3-675b0450b75f@cloudzeeland.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 15 Feb 2020 14:31:59 +0100
Jos Chrispijn <bsduser@cloudzeeland.nl> 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!
If the nonesense directories are not empty and you want them gone
complete with contents then:
find /mysources -name nonesense -type d -depth -exec rm -rf {} \;
If they're empty then:
find /mysources -name nonesense -type d -delete
--
Steve O'Hara-Smith <steve@sohara.org>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200215134155.6f8e6f901c9175dbdbef7808>
