# File lib/larch.rb, line 51
    def copy_all(imap_from, imap_to, subscribed_only = false)
      raise ArgumentError, "imap_from must be a Larch::IMAP instance" unless imap_from.is_a?(IMAP)
      raise ArgumentError, "imap_to must be a Larch::IMAP instance" unless imap_to.is_a?(IMAP)

      @copied  = 0
      @deleted = 0
      @failed  = 0
      @total   = 0

      imap_from.each_mailbox do |mailbox_from|
        next if excluded?(mailbox_from.name)
        next if subscribed_only && !mailbox_from.subscribed?

        if imap_to.uri_mailbox
          mailbox_to = imap_to.mailbox(imap_to.uri_mailbox)
        else
          mailbox_to = imap_to.mailbox(mailbox_from.name, mailbox_from.delim)
        end

        mailbox_to.subscribe if mailbox_from.subscribed?

        copy_messages(mailbox_from, mailbox_to)
      end

    rescue => e
      @log.fatal e.message

    ensure
      summary
      db_maintenance
    end