From: anyr <anyr@tut.by>
To: ALT Linux Community <community@lists.altlinux.org>
Subject: Re: [Comm] Переход с KMail на Thunderbird - проблема с Maildir.
Date: Thu, 3 Nov 2005 02:01:34 +0000
Message-ID: <200511030201.34843.anyr@tut.by> (raw)
In-Reply-To: <200510251110.10231.altlinux-community@yandex.ru>
#!/bin/bash
#Transformation d'une boite KMail en Thunderbird
#Preservation de la structure des messages
#
laDate=`date`;
from="From - "$laDate;
pwdX=`ls -dm ~/Mail`;
scandir() {
echo "on scan "${pwdX}/$1;
repCur=$1;
x=`ls -m ${pwdX}/$repCur`; #On recupere les repertoires
echo "-$x-";
nbre=1; #On commence par le premier
data=`echo $x | cut -d "," -f $nbre;`; #On recupre le premier
repertoire
echo $data;
#On cree l'arborence
curDir=KmailToThunderbird.sbd;
if [[ ! -d $curDir ]]; then
mkdir $curDir;
touch KmailToThunderbird;
fi;
#On parcourt tous les repertoires
while [[ "X"$data != "X" ]];do
echo ${pwdX}/$repCur/${data}/cur;
dirToCreate=`echo $repCur | cut -c 2-`;
#On cree le repetoire qui va bien
mkdir "${curDir}/$dirToCreate/.${data}.directory";
#ls -1 "${pwdX}/$1/${data}/cur"; #On liste les fichiers a
recuperer
#On tranform le format Kmail en format Thunderbird
echo -n > Temp; #On cree le fichier pour etre sur d'en avoir
un
for leFichier in `ls "${pwdX}/$repCur/${data}/cur"`; do
#Test pour les pieces jointes
if [[ `fgrep -i "content-type: application"
"${pwdX}/$repCur/${data}/cur/${leFichier}"` ]]; then
status2=10000000;
else
status2=00000000;
fi;
echo $from >> Temp;
echo "X-Mozilla-status: 0000" >> Temp #On les met en
attente de lecture
echo "X-Mozilla-status2: "$status2 >> Temp
cat "${pwdX}/$repCur/${data}/cur/$leFichier" | mawk
'{if (substr($0,0,6) ~ "From ") print "",$0; else print;}' >> Temp
echo >> Temp;
done;
#On deplace le fichier Temp vers le bon repertoire
mv Temp "${curDir}/$dirToCreate/$data";
#On doit aussi voir si il existe ou non un repertoire
contenant messages
if [ -d "${pwdX}/$repCur/.${data}.directory" ]; then
#On a un repertoire en dessous
echo "On doit analyser le contenu de : ".
${data}.directory;
$0 "$repCur/.${data}.directory";
fi;
#On adapte le nom pour un integration dans Thunderbird
mv "${curDir}/$dirToCreate/.${data}.directory"
"${curDir}/$dirToCreate/${data}.sbd";
nbre=$[$nbre + 1];
data=`echo $x | cut -s -d "," -f $nbre| cut -c 2-;`; #On passe
au suivant
echo "-$data-";
done;
}
#On demarre le script
scandir "$1" ;
prev parent reply other threads:[~2005-11-03 2:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-24 17:04 ABATAPA
2005-10-24 18:29 ` Yura Kalinichenko
2005-10-25 7:10 ` ABATAPA
2005-11-03 2:01 ` anyr [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200511030201.34843.anyr@tut.by \
--to=anyr@tut.by \
--cc=community@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git