This commit is contained in:
Nick Bebout 2011-03-12 02:44:18 +00:00
parent c63048cca3
commit 3895b22b0a
6 changed files with 81 additions and 25079 deletions

View file

@ -1,17 +1,20 @@
RCS file: RCS/imapsync,v RCS file: RCS/imapsync,v
Working file: imapsync Working file: imapsync
head: 1.139 head: 1.140
branch: branch:
locks: strict locks: strict
gilles: 1.139
access list: access list:
symbolic names: symbolic names:
keyword substitution: kv keyword substitution: kv
total revisions: 139; selected revisions: 139 total revisions: 140; selected revisions: 140
description: description:
---------------------------- ----------------------------
revision 1.139 locked by: gilles; revision 1.140
date: 2005/10/30 10:16:52; author: gilles; state: Exp; lines: +21 -8
Added --expunge1 --expunge2 options
----------------------------
revision 1.139
date: 2005/07/16 12:46:22; author: gilles; state: Exp; lines: +6 -6 date: 2005/07/16 12:46:22; author: gilles; state: Exp; lines: +6 -6
server list server list
---------------------------- ----------------------------

12
README
View file

@ -2,7 +2,7 @@ NAME
imapsync - IMAP synchronization, copy or migration tool. Synchronize imapsync - IMAP synchronization, copy or migration tool. Synchronize
mailboxes between two imap servers. Good at IMAP migration. mailboxes between two imap servers. Good at IMAP migration.
$Revision: 1.139 $ $Revision: 1.140 $
INSTALL INSTALL
imapsync works fine under any Unix OS. imapsync works fine under any Unix OS.
@ -48,7 +48,7 @@ SYNOPSIS
[--skipheader <regex>] [--skipheader <regex>]
[--useheader <string>] [--useheader <string>] [--useheader <string>] [--useheader <string>]
[--skipsize] [--skipsize]
[--delete] [--expunge] [--delete] [--expunge] [--expunge1] [--expunge2]
[--subscribed] [--subscribe] [--subscribed] [--subscribe]
[--nofoldersizes] [--nofoldersizes]
[--dry] [--dry]
@ -72,8 +72,8 @@ DESCRIPTION
You can decide to delete the messages from the source mailbox after a You can decide to delete the messages from the source mailbox after a
successful transfert (it is a good feature when migrating). In that successful transfert (it is a good feature when migrating). In that
case, use the --delete option, and run imapsync again with the --expunge case, use the --delete option, and run imapsync again with the
option. --expunge1 option.
You can also just synchronize a mailbox A from another mailbox B in case You can also just synchronize a mailbox A from another mailbox B in case
you just want to keep a "live" copy of B in A. you just want to keep a "live" copy of B in A.
@ -214,7 +214,7 @@ IMAP SERVERS
HUGE MIGRATION HUGE MIGRATION
Have a special attention on options --subscribed --subscribe --delete Have a special attention on options --subscribed --subscribe --delete
--expunge --maxage --maxsize --useheader --expunge --expunge1 --expunge2 --maxage --maxsize --useheader
If you have many mailboxes to migrate think about a little shell If you have many mailboxes to migrate think about a little shell
program. Write a file called file.csv (for example) containing users and program. Write a file called file.csv (for example) containing users and
@ -261,5 +261,5 @@ AUTHOR
teaching free open and gratis softwares. Don't hesitate to pay him for teaching free open and gratis softwares. Don't hesitate to pay him for
that services. that services.
$Id: imapsync,v 1.139 2005/07/16 12:46:22 gilles Exp gilles $ $Id: imapsync,v 1.140 2005/10/30 10:16:52 gilles Exp $

View file

@ -1 +1 @@
1.139 1.140

File diff suppressed because one or more lines are too long

View file

@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration
tool. Synchronize mailboxes between two imap servers. Good tool. Synchronize mailboxes between two imap servers. Good
at IMAP migration. at IMAP migration.
$Revision: 1.139 $ $Revision: 1.140 $
=head1 INSTALL =head1 INSTALL
@ -54,7 +54,7 @@ $Revision: 1.139 $
[--skipheader <regex>] [--skipheader <regex>]
[--useheader <string>] [--useheader <string>] [--useheader <string>] [--useheader <string>]
[--skipsize] [--skipsize]
[--delete] [--expunge] [--delete] [--expunge] [--expunge1] [--expunge2]
[--subscribed] [--subscribe] [--subscribed] [--subscribe]
[--nofoldersizes] [--nofoldersizes]
[--dry] [--dry]
@ -86,7 +86,7 @@ connection.
You can decide to delete the messages from the source mailbox You can decide to delete the messages from the source mailbox
after a successful transfert (it is a good feature when migrating). after a successful transfert (it is a good feature when migrating).
In that case, use the --delete option, and run imapsync again In that case, use the --delete option, and run imapsync again
with the --expunge option. with the --expunge1 option.
You can also just synchronize a mailbox A from another mailbox B You can also just synchronize a mailbox A from another mailbox B
in case you just want to keep a "live" copy of B in A. in case you just want to keep a "live" copy of B in A.
@ -246,6 +246,8 @@ Have a special attention on options
--subscribe --subscribe
--delete --delete
--expunge --expunge
--expunge1
--expunge2
--maxage --maxage
--maxsize --maxsize
--useheader --useheader
@ -303,7 +305,7 @@ Gilles LAMIRAL earn his living writing, installing,
configuring and teaching free open and gratis configuring and teaching free open and gratis
softwares. Don't hesitate to pay him for that services. softwares. Don't hesitate to pay him for that services.
$Id: imapsync,v 1.139 2005/07/16 12:46:22 gilles Exp gilles $ $Id: imapsync,v 1.140 2005/10/30 10:16:52 gilles Exp $
=cut =cut
@ -330,7 +332,7 @@ my(
$maxsize, $maxage, $maxsize, $maxage,
$skipheader, @useheader, $skipheader, @useheader,
$skipsize, $foldersizes, $buffersize, $skipsize, $foldersizes, $buffersize,
$delete, $expunge, $dry, $delete, $expunge, $expunge1, $expunge2, $dry,
$authmd5, $authmd5,
$subscribed, $subscribe, $subscribed, $subscribe,
$version, $VERSION, $help, $version, $VERSION, $help,
@ -348,7 +350,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option. use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.139 2005/07/16 12:46:22 gilles Exp gilles $ '; $rcs = ' $Id: imapsync,v 1.140 2005/10/30 10:16:52 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/; $rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN"; $VERSION = ($1) ? $1 : "UNKNOWN";
@ -385,8 +387,8 @@ $error=0;
my $banner = join("", my $banner = join("",
'$RCSfile: imapsync,v $ ', '$RCSfile: imapsync,v $ ',
'$Revision: 1.139 $ ', '$Revision: 1.140 $ ',
'$Date: 2005/07/16 12:46:22 $ ', '$Date: 2005/10/30 10:16:52 $ ',
"\n", "\n",
"Mail::IMAPClient version used here is ", "Mail::IMAPClient version used here is ",
$VERSION_IMAPClient,"\n" $VERSION_IMAPClient,"\n"
@ -958,6 +960,15 @@ FOLDER: foreach my $f_fold (@f_folders) {
} }
} }
} }
if ($expunge1){
print "Expunging source folder $f_fold\n";
unless($dry) { $from->expunge() };
}
if ($expunge2){
print "Expunging target folder $t_fold\n";
unless($dry) { $to->expunge() };
}
print "Time : ", timenext(), " s\n"; print "Time : ", timenext(), " s\n";
} }
@ -1156,6 +1167,8 @@ Several options are mandatory.
are expunged if option --expunge is given. are expunged if option --expunge is given.
no expunge is done on destination account but no expunge is done on destination account but
it will change in future releases. it will change in future releases.
--expunge1 : expunge messages on source account.
--expunge2 : expunge messages on target account.
--syncinternaldates : sets the internal dates on host2 same as host1 --syncinternaldates : sets the internal dates on host2 same as host1
--buffersize <int> : sets the size of a block of I/O. --buffersize <int> : sets the size of a block of I/O.
--maxsize <int> : skip messages larger than <int> bytes --maxsize <int> : skip messages larger than <int> bytes

46
learn/adjust_time.pl Normal file
View file

@ -0,0 +1,46 @@
#! /usr/bin/perl -w
#
# Outlook (IMAP) manages mail dates from the creation date of the mail
# instead of the content of the field 'Date:', included into the mail.
# This script modifies the mtime of the mails, according to the 'Date:' field
# value.
# Before running the script, you have to build a list of the mail files.
# For example, with the MailDir format, the file has been built whith :
# find /var/lib/vmail -type f -a -name '[0-9]*' > /tmp/toto
# Depending on the quality of the 'Date:' field, some mtime modification fails.
# You have to correct it manually.
# I ran it on 18733 mails, and 45 failed.
use strict;
my @a;
my $f;
my @b;
my @date;
my $d;
my @r;
my $s;
open(F, "</tmp/toto") or die "can't open toto";
@a = <F>;
chomp @a;
foreach $f (@a)
{
open(F1, "<$f") or die "can't open $f";
@b = <F1>;
chomp @b;
close F1;
@date = grep /^Date: /, @b;
next if scalar @date <= 0;
$d = $date[0];
$d =~ s/Date: (.*)$/$1/i;
print "$d\n";
@r = `/usr/bin/touch -md '$d' '$f' 2>&1`;
print "$f\n";
foreach $d (@r)
{
print "$d\n"
}
}