nmh-workers
[Top] [All Lists]

Re: Sharding by Year.

2021-06-07 17:10:11
Michael Richardson wrote in
 <31957.1623081930@localhost>:
 |Ralph Corderoy <ralph(_at_)inputplus(_dot_)co(_dot_)uk> wrote:
 |>> outgoing/y2001  has 1287 messages  (1-1287).
 |>> outgoing/y2002  has 9335 messages  (1-9335).
 |>> outgoing/y2003  has 3909 messages  (1-3909).
 |
 |> Out of interest, how did you pick what's in each year?  Textually, with
 |> ‘2002’ appearing in the Date field.  Or as a year and if so was that
 |> local time, the sender's time, or UTC?  :-)
 |
 |Well, it's outgoing email, so it's all mine, so it's all in my time zone.
 |
 |On Jan. 1, I do:
 |  refile -src +outgoing all +outgoing/y2020

Damn, i just call a .rotate.sh asap, this year at 00:11:19.
Relevant part is

  cd mail || exit 4

  find . -maxdepth 1 -type f \
    -not -name 'download' -not -name '*gmane*' \
    -not -name '*.xz' -not -name '*.zst' \
    -not -name '*.sh' -not -name .yearstamp |
  while read f; do
    f=`basename ${f}`
    if echo ${f} | grep -E '^[1-9][0-9]{3}\.'; then
      :
    elif [ -s ${f} ]; then
      echo "Rotating ${f} to ${YEAR}.${f}.zst"
      zstd -T0 -19 -zc < ${f} > ${YEAR}.${f}.zst
      chmod 0400 ${YEAR}.${f}.zst
      : > ${f}
    else
      echo "${f} is an empty file, removing it"
      rm ${f}
    fi
  done

  echo $YEAR > .yearstamp

Of course sometimes threads cross the line.  Thus..

 |well, I often forget Jan. so, "all" might be adjusted having run "scan"
 |
 |It would be nice to be able to treat these folders a single folder for
 |certain operations.

Oh i wish my MUA could do this yet.  For many years in TODO:

     The absolute sensation would be joinable operations over multiple
     open mailboxes, e.g., views over multiple such!

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


<Prev in Thread] Current Thread [Next in Thread>