<<< Date Index >>>     <<< Thread Index >>>

Re: Reliable/safe way of removing empty maildirs?



> >> chmod a-w dir/new
> >> if [ `find dir -type f` ] ; then
> >
> > You have to do something like this instead:
[snip other responses]

Perhaps I've misunderstood the reason for doing this, but I would just
ask find to do a rmdir, and let it fail if the directory isn't empty.

find dir -depth -type d -exec rmdir {} \;

If 'dir' is still around when that finishes, it's probably because
there's a file in there now.  In the meantime, it's removed all empty
subtrees.

-- 
Darren Dunham                                           ddunham@xxxxxxxx
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >