Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!munnari.oz.au!uniwa!DIALix!metapro!bernie From: bernie@metapro.DIALix.oz.au (Bernd Felsche) Newsgroups: comp.unix.questions Subject: Re: How do I tell when a directory is empty in a script? Message-ID: <1991Apr18.054735.6733@metapro.DIALix.oz.au> Date: 18 Apr 91 05:47:35 GMT References: <1991Mar30.040400.13893@ncsu.edu> <1991Mar30.225406.20493@dg-rtp.dg.com> <1991Apr3.142150.4445@athena.mit.edu> <9424@mentor.cc.purdue.edu> <900@homer.UUCP> <1991Apr15.180550.14750@beaver.cs.washington.edu> Organization: MetaPro Systems, Perth, Western Australia Lines: 12 I suppose this might have been mentioned before.... If you can write to the parent, then try to rmdir it. rmdir will fail (to the best of my knowledge/experience) if there's anything in the directory. rmdir $dir && mkdir $dir || echo $dir not empty 1>&2 Good enough? Thought not! -- Bernd Felsche, _--_|\ #include Metapro Systems, / sale \ Fax: +61 9 472 3337 328 Albany Highway, \_.--._/ Phone: +61 9 362 9355 Victoria Park, Western Australia v Email: bernie@metapro.DIALix.oz.au