Re: Reliable/safe way of removing empty maildirs?
- To: mutt-users@xxxxxxxx
- Subject: Re: Reliable/safe way of removing empty maildirs?
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Thu, 6 Dec 2007 10:03:20 -0600
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date:from:to:subject:message-id:references:mime-version:content-type:in-reply-to; q=dns/txt; s=default; bh=tEGu7nmvImA9wicbmSy56TMWaAQ=; b=TH2t22+wz0SiHqLZ58m4e11I8RdeYjED3KQ4Q06iW6RRlTWR4dPUwuuvafqdSYzirCS/RSl8YnhsU4+wlk2KvRwKCgJiWVl0dv8R+/+laUaHyG+l8Gd5zqxCOPtZSXbQz+XIRiNIwjwk2pxRuq6X3Ii2th3IOT8h2c0i3O2FQXw=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=GhiuTH/MCD5eRwzzztpF8jnSTi35ShZC1+aEgVwFnkicz/ZL6cJEbvSLWoesHLB6a9H+ThDH4vgt1FncKc7xIk2tQwI2McDHdGyl4Y9DDJ99xBJ/PL0TeVkASeYjrWJR6Z60cvXCsHOcryIc8GFUE7MOWmG1zWRS8FqBKgLmezA=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent;
- In-reply-to: <20071206154620.GB4078@xxxxxxxxxxxxxxxxxxxxxxxxx>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- References: <20071206130313.GB13112@th-shell-1> <20071206154620.GB4078@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.17 (2007-11-21)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday, December 6 at 04:46 PM, quoth Rado S:
>=- Chris G wrote on Thu 6.Dec'07 at 13:03:13 +0000 -=
>
>> What's a reliable way of removing empty maildirs?
>> Presumably it's possible but you'd have to follow some protocol that
>> wouldn't interfere with the proper writing of messages to the maildir.
>
>chmod a-w dir/new
>rm -rf dir
Well, that's not *quite* safe, now is it? There's a race condition
between deciding that a maildir is empty and then changing the
permissions such that no one can deliver mail to it. It would have to
be more like this:
chmod a-w dir/new
if [ `find dir -type f` ] ; then
echo "Not empty!"
chmod a+w dir/new
else
rm -rf dir
fi
~Kyle
- --
I think we ought always to entertain our opinions with some measure of
doubt. I shouldn't wish people dogmatically to believe any philosophy,
not even mine.
-- Bertrand Russell
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iD8DBQFHWB1IBkIOoMqOI14RAp8LAJ0YXKrpUr9TCwaswVpky/MF8UH6rACgiECX
1CKaU1As7wX9YrRyQPy50Cw=
=ibUG
-----END PGP SIGNATURE-----