Get cyrus-imap folder size without "du" tool

Adam Tauno Williams awilliam at whitemice.org
Fri Apr 2 08:07:55 EDT 2010


On Thu, 2010-04-01 at 21:54 -0500, Dan White wrote:
> On 01/04/10 22:34 -0400, Adam Tauno Williams wrote:
> >On Thu, 2010-04-01 at 13:54 -0700, Andrew Morgan wrote:
> >> Those values are all annotations.  The annotation you want is:
> >> 
> >>    /vendor/cmu/cyrus-imapd/size
> >
> >I suspected as much but haven't had much luck getting a value.
> >
> >import imaplib
> >m = imaplib.IMAP4('imap.mormail.com')
> >m.login(***********************)
> >m.getannotation('user.adam', '"/vendor/cmu/cyrus-imapd/size"', '"*"')
> >---- ('OK', [None])
> >m.getannotation('user.adam', '"/vendor/cmu/cyrus-imapd/size"',
> >'"value.shared"')
> >----('OK', [None])
> >m.getannotation('user.adam', '/vendor/cmu/cyrus-imapd/size',
> >'"value.shared"')
> >-----('OK', [None])
> >m.getannotation('user.adam', '/vendor/cmu/cyrus-imapd/size',
> >'("value.shared")')
> >----('OK', [None])
> >m.getannotation('user.adam', '/vendor/cmu/cyrus-imapd/size', '("
> >value.shared")')
> >----('OK', [None])
> >Nothing produces a value.  Any pointers?  There seems to be basically
> >zero documentation about IMAP annotations.
> as an admin:
> c getannotation "user/dwhite at olp.net" "/vendor/cmu/cyrus-imapd/size"
> "value"
> * ANNOTATION "user/dwhite at olp.net" "/vendor/cmu/cyrus-imapd/size" ("value.shared" "35905")
> So it seems to care about your unixhierarchysep if you have it set.
> Cyrus's implementation appears to be based on a draft version of RFC 5464,
> namely:
> http://tools.ietf.org/html/draft-daboo-imap-annotatemore-08

Ok.  I'm assuming Python's IMAP annotation support is broken.  I can't
get it to work with any syntax.

>>> m.getannotation('user.adam', '/vendor/cmu/cyrus-imapd/expire',
'value')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/imaplib.py", line 454, in getannotation
    typ, dat = self._simple_command('GETANNOTATION', mailbox, entry,
attribute)
  File "/usr/lib64/python2.6/imaplib.py", line 1059, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/usr/lib64/python2.6/imaplib.py", line 896, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: GETANNOTATION command error: BAD ['Missing annotation
attribute']
>>> m.getannotation('user/adam', '/vendor/cmu/cyrus-imapd/expire',
'value')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/imaplib.py", line 454, in getannotation
    typ, dat = self._simple_command('GETANNOTATION', mailbox, entry,
attribute)
  File "/usr/lib64/python2.6/imaplib.py", line 1059, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/usr/lib64/python2.6/imaplib.py", line 896, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: GETANNOTATION command error: BAD ['Missing annotation
attribute']





More information about the Info-cyrus mailing list