Format of filenames

manitou-spool uses the result of:

date "+%Y%m%d-%H%M%S"`"-$$

as the variable part for mail filenames. $$ denotes the Unix pid and has the property of being unique at any particular time. It is used in this case to avoid name clashes for files created within the same second. The full name is mail-<datetime-spec>-<pid>.received for files that have not been processed yet, and mail-<datetime-spec>-<pid>.processed for files that have been processed, where <datetime-spec> is YYYYMMDD-HHMMSS.

Changing the modification time of mail files

By default when importing a mail file, manitou-mdx assigns the file modification time to the date and time of the message. If for some reason, the process of creating those files falls behind, the modification times can be reset by using the date in file names. Below is a shell script that parses the file names and updates modification times for *.received files:

for f in `ls *.received`
do
  d=`echo $f|sed -r 's/mail-([0-9]+)-([0-9]{4})([0-9]{2})-([0-9]+).received/\1\2.\3/'`
  touch -t $d $f
done