#!/bin/sh #---------------------------------------------------------------------------------------- # /usr/bin/archmaildir - a simple mailbox archiver for maildir mailboxes # # Copyright (c) 2020-2025 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2020-06-14 jed # Last Update: $Id$ # # Usage: archmdir [-h|--version] # archmdir MODE [OPTIONS] -d [, ...] # archmdir MODE [OPTIONS] -o [, ...] # # The available modes and options are described below # in the 'show_help' function. # # Example: archmaildir --copy --date-header --date 2017-12-31 --extension 2017 \ # --archive-path /home/ralf/.imapmail/.Archiv/.Ablage --format maildir # "/home/ralf/.imapmail/.Ablage.Allgemein" # # Target dir: /home/ralf/.imapmail/.Archiv/.Ablage/.Allgemein\2e2017 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------------------- . /var/install/include/eislib . /var/install/include/jedlib if [ "$1" != '--version' ] then # skip loading to prevent collision # with jedlib internal version function . /var/install/include/jedlib fi # debug mode: true/false #debug=true if ${debug:-false} then exec 2>/tmp/$(basename ${0})-trace$$.log set -x ask_debug=true export ask_debug fi #---------------------------------------------------------------------------------------- # show command help #---------------------------------------------------------------------------------------- show_help () { echo 'Archmdir: a simple mailbox archiver for maildir mailboxes.' echo 'Archive all selected messages from the specified mailbox(es).' echo echo 'usage:' echo ' archmdir [-h|--version]' echo ' archmdir MODE [OPTIONS] -d [, ...]' echo ' archmdir MODE [OPTIONS] -o [, ...]' echo echo 'MODES' echo ' -a, --archive archive mode: archive selected messages' echo ' -k, --kill kill mode: delete selected messages' echo ' -l, --list list mode: list what messages will be' echo ' selected' echo ' -y, --copy copy mode: copy selected messages' echo echo 'OPTIONS' echo ' -d, --date treshold date for messages' echo ' -D, --date-header use 'Date:' header to age the messages' echo ' -e, --extension suffix for the archive mailbox, "none" means no' echo ' extension (default: archived)' echo ' --format specify mailboxes format (default: maildir)' echo ' !! This option only exists for archmbox command' echo ' !! line compatibility and is without any function.' echo ' -h, --help prints help' echo ' --keep-flagged keep flagged messages' echo ' --keep-unread keep unread messages' echo ' -o, --offset offset (in days) from today for treshold date' echo ' -1 means "all messages"' echo ' -p, --archive-path ' echo ' where to store archive mailbox (full path)' echo ' -r, --reverse offset means messages newer rather than older' echo ' --simulate simulate the choosen action only' echo ' -t, --tmpdir directory to store temporary files (full path)' echo ' (default: "/tmp")' echo ' --time