[Gllug] quick question - exclusive rm -r

Progga progga at BengaLinux.Org
Mon Nov 27 14:35:11 UTC 2006


On Mon, Nov 27, 2006 at 12:59:23PM +0000, Progga wrote:
> On Mon, Nov 27, 2006 at 02:21:46AM +0100, salsaman wrote:
> 
> > Is it possible to say "delete all subdirectories of ., _except_ those 
> > containing the file foo" in one line of shell script ? If so, how ?
> 
> The following works in my FreeBSD box under bash:
> 
> $ find ./ -type d -not -exec [ -e {}/foo ] \; -delete
> find: -delete: ./: relative path potentially not safe
> 
> The error msg can be ignored.

Sorry, it won't work.  I had bad test case :-(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20061127/a295d941/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list