Renaming mailboxes

David Moyes <[email protected]>
Newsgroups gmane.mail.imap.cyrus
Message-ID <[email protected]>
I want to rename a mailbox (and all of its descendants), however I am
struggling with what, on the surface, would appear to be a simple task.

I first tried to use cyradm rename command to rename user.foo to
[email protected], like this:

    localhost> rename user.foo [email protected]

However the rename command does not appear to be recursive, and I could
not find any argument to tell it to recurse. Do I have this right or am
I doing something wrong?

I decided to try it in a Perl script using Cyrus::IMAP::Admin. By doing
a `list` I could get the mailbox and its descendants like this:

    @mailboxes = $client->list("user/$oldname");
    @mailboxes_sub = $client->list("user/$oldname/*");
    push (@mailboxes , @mailboxes_sub);

(I found that listing "user/$oldname*" got me user.foo but also
user.foobar so I had to combine two calls to prevent that.)

Then I could iterate over the mailboxes doing

    $client->rename( $oldmailbox, $mailbox );

However, nothing works after the first rename; the program just exits,
not even "or die" error messages are displayed. In case it means
anything, the exit status is 141 which I think indicates a SIGPIPE (as
confirmed using `kill -l "$?"` which returns `PIPE`).

I did also notice a similar thing in cyradm, that after doing a rename
that subsequent action caused cyradm to exit:

localhost> rename user/testuser/Trash user/[email protected]/Trash
renamemailbox:
localhost> lm          # this curiously returns nothing!

localhost> echo $?
0
localhost> lm
[cyrus@fee7fffd9be7 ~]$ echo $?
141


Any help would be greatly appreciated. I am currently using cyrus-imapd
3.0.13-3 on Arch Linux.


----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.