File indexing completed on 2024-12-22 05:01:13

0001 #!/bin/bash
0002 # This script converts MH mail folders to the folders that KMail
0003 # prefers (all messages in one file)
0004 #
0005 # usage:  mh2kmail <dirname>
0006 #
0007 # SPDX-FileContributor: Stefan Taferner <taferner@kde.org>
0008 # SPDX-License-Identifier: GPL-2.0-only
0009 #
0010 if [ "X$*" = "X" ]; then
0011   echo "usage: mh2kmailr <dirname>"
0012   exit 0
0013 fi
0014 
0015 MH_DIR=$1
0016 
0017 for d in `/usr/bin/find $MH_DIR -type d -print|sed -e :a -e 's/^.\{1,5\}$/ &/;ta'|sort`; do
0018 FOLDER=${d}.mbx
0019 
0020 # remove old kmail folder if any
0021 rm -f $FOLDER
0022 
0023 for f in `/usr/bin/find $d -type f -maxdepth 1 -print|sed -e :a -e 's/^.\{1,5\}$/ &/;ta'|sort`; do
0024   echo "From ???@??? 00:00:00 1997 +0000" >> $FOLDER
0025   cat $f >> $FOLDER
0026 done
0027 
0028 echo "Done. Messages stored in file $FOLDER."
0029 done