[Dovecot] doveadm with multiple commands

Ben Morrow ben at morrow.me.uk
Mon Sep 24 20:01:02 EEST 2012


At  2PM +0300 on 24/09/12 you (Timo Sirainen) wrote:
> On 24.9.2012, at 14.44, A.L.E.C wrote:
> 
> > next is "run" or "pipe", but what if you create global separator option
> > and detect multi-command syntax usage automatically without a keyword?
> > 
> > Syntax for doveadm would be
> > 
> > doveadm [-Dv] [-f formatter] [-s separator] [-A | -u wildcards ] command
> > [command_options] [command_arguments] [separator command
> > [command_options] [command_arguments] [...]]
> > 
> > and example
> > 
> > doveadm -A -s : expunge mailbox Trash savedbefore 7d : purge
> 
> Hmm. Yes, that might work. Although it would have to be:
> 
> doveadm expunge -A -s : mailbox Trash savedbefore 7d : purge
> 
> because both -A and -s are mail command specific parameters, which
> won't work for non-mail commands.
> 
> Hmm. This reminds me also that it would be possible with some extra
> work to do some command interaction. IMAP supports saving search
> results, which can later be accessed with $ parameter. So this could
> be made to work:
> 
> doveadm search -s : from foo : fetch text \$ : expunge \$

This is turning into a proper scripting language, so perhaps something
like

    doveadm -e 'search from foo; fetch text $; expunge $'

with 'doveadm -F file' to run a script file?

Ben




More information about the dovecot mailing list