Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 2020 13:41:55 +0000
From:      Steve O'Hara-Smith <>
Subject:   Re: Removal script
Message-ID:  <>
In-Reply-To: <>
References:  <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Sat, 15 Feb 2020 14:31:59 +0100
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!

	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 <>

Want to link to this message? Use this URL: <>