On Wed, Sep 23, 2009 at 09:03:09AM -0500, Kyle Wheeler wrote: > On Wednesday, September 23 at 09:45 PM, quoth Wu, Yue: > >The logic I need is: > > > > if maildir A has no mails(new/ tmp/ cur/ are empty) > > rm -r A > > endif > > Ahh. How about: > > if [ $(find A -type f | wc -l) -eq 0 ] ; then > rm -r A > fi >
Thanks for all replies, mutt uses its own maildir so I have no issue about the two apps read/write the same maildirs at one time. I don't know sh, and I've tried the following sh script, but it doesn't work: #!/bin/sh DIR="~/temp/mails/*" for d in ${DIR}; do if [ $(find d -type f | wc -l) -eq 0 ] ; then rm -r d fi done It says: y...@bsd ~ > ./del_maildir.sh find: d: No such file or directory rm: d: No such file or directory y -- Hi, Wu, Yue