cyrus-migrate.pl
changeset 3 8d180e2a778c
parent 1 fba909f76790
child 4 29ee99139025
--- a/cyrus-migrate.pl	Fri Jun 12 15:08:29 2009 +0200
+++ b/cyrus-migrate.pl	Fri Jun 12 15:13:00 2009 +0200
@@ -35,6 +35,7 @@
     --dry-run	    dry run ($opt_dry)
     --skip	    skipp missing mailboxes ($opt_skip)
     --logdir=s	    directory where logfiles will go to ($opt_logdir)
+    --maxage=i	    synchronize only mails younger than $(opt_maxage)
     --help	    this help text
 #
 
@@ -60,11 +61,13 @@
 my $opt_dry = 0;
 my $opt_skip = 0;
 my $opt_logdir = "./imapsync-log/";
+my $opt_maxage = 0;
 
 GetOptions(
     "dry-ryn"	    =>	\$opt_dry,
     "skip"	    =>	\$opt_skip,
     "logdir=s"	    =>	\$opt_logdir,
+    "maxage=i"	    =>	\$opt_maxage,
 ) or die eval "\"$usage\"";
 
 
@@ -101,7 +104,9 @@
 foreach my $mailbox (keys %password_of_account_) {
     ### processing mailbox: $mailbox
     my $imapsync_options = "";
-    $imapsync_options .= " --dry" if $opt_dry;
+    $imapsync_options .= " --dry"		    if $opt_dry;
+    $imapsync_options .= " --maxage=$opt_maxage"    if $opt_maxage > 0;
+
     my $logfile = "$opt_logdir/$mailbox.log";
 
     my $cmd = sprintf(	"imapsync %s --ssl1 --ssl2 --subscribe"