This commit is contained in:
Nick Bebout 2012-09-02 19:08:57 -05:00
parent 495d5a9526
commit c08a56e486
277 changed files with 692 additions and 10803 deletions

61
examples/archive_per_month Executable file
View file

@ -0,0 +1,61 @@
#!/bin/sh
# $Id: archive_per_month,v 1.5 2012/08/12 16:41:22 gilles Exp gilles $
# Translate Jan to 01, Feb to 02 etc.
month_number() {
test X"$1" = X"Jan" && echo 01 && return
test X"$1" = X"Feb" && echo 02 && return
test X"$1" = X"Mar" && echo 03 && return
test X"$1" = X"Apr" && echo 04 && return
test X"$1" = X"May" && echo 05 && return
test X"$1" = X"Jun" && echo 06 && return
test X"$1" = X"Jul" && echo 07 && return
test X"$1" = X"Aug" && echo 08 && return
test X"$1" = X"Sep" && echo 09 && return
test X"$1" = X"Oct" && echo 10 && return
test X"$1" = X"Nov" && echo 11 && return
test X"$1" = X"Dec" && echo 12 && return
echo 00
}
# Calculates the last day of month
# Expect GNU date command
last_day_of_year_month() {
year_ld=$1
month_ld=$2
next_month_day_01=`date -d "$year_ld-$month_ld-15 next month" +%Y-%m-01`
#echo $next_month_day_1
# last day is 1st day of next month minus 1 day
date -d "$next_month_day_01 -1 day" +%d
}
# Replace ... with standard options like --host1 --user1 --password1 --host2 --user2 --password2
# Remove the echo at the beginning
archive_year_month() {
year=$1
month=$2
month_n=`month_number $month`
last_day=`last_day_of_year_month $year $month_n`
echo imapsync ... \
--search "SENTSINCE 1-$month-$year SENTBEFORE $last_day-$month-$year" \
--regextrans2 "s{.*}{Archive/$year/$month_n}"
}
#
for year_archive in 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012; do
for month_archive in "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"; do
archive_year_month $year_archive $month_archive
done
done
# End of $Id: archive_per_month,v 1.5 2012/08/12 16:41:22 gilles Exp gilles $

27
examples/file.txt Normal file
View file

@ -0,0 +1,27 @@
# Example file.txt for imapsync massive migration.
#
# ==== Windows ====
# Thanks to http://ss64.com/nt/for_f.html for
# the Windows example of a for loop
#
# This file can be used on Windows with the following line in a batch
# FOR /F "tokens=1,2,3,4 delims=; eol=#" %%G IN (file.txt) DO imapsync --host1 imap.truc.org --user1 %%G --password1 %%H --host2 imap.trac.org --user2 %%I --password2 %%J
#
# A line beginning with # is a comment thanks to option Win32 eol=#
# Separator is character ; it can be changed by any character changing delims=;
# Each line contains 4 columns, columns are parameters for --user1 --password1 --user2 --password2
#
# ==== Unix ====
# This file can be used on Unix with the following line in a Bourne shell script
# { while IFS=';' read u1 p1 u2 p2; do imapsync --user1 "$u1" --password1 "$p1" --user2 "$u2" --password2 "$p2" ... ; done ; } < file.txt
#
# Separator is character ; it can be changed by any character changing IFS=';'
# Each line contains 4 columns, columns are parameters for --user1 --password1 --user2 --password2
#
# Now the data example
user001_1;password001_1;user001_2;password001_2
user002_1;password002_1;user002_2;password002_2
user003_1;password003_1;user003_2;password003_2
# Another comment blabla
user004_1;password004_1;user004_2;password004_2
user005_1;password005_1;user005_2;password005_2

View file

@ -0,0 +1,8 @@
REM imapsync example batch for Windows users
REM lines beginning with REM are just comments
REM Replace imap.foo.org toto secretoto 192.168.42.4 titi secretiti with your own values
.\imapsync.exe --host1 imap.foo.org --user1 toto --password1 "secretoto" --host2 192.168.42.4 --user2 titi --password2 "secretiti"