Migration using imapsync

Andy Bennett andyjpb at ashurst.eu.org
Tue Sep 20 08:59:46 EDT 2011


Hi,

> I'm trying to move from an old uw-imap to Cyrus 2.4.8 using imapsync 1.456.
> 
> So far my main problem has been the lack off useful documentation on
> imapsync's part. Specially on the --regextrans2 parameter. I managed
> to figure that one out by 2 days of Googling and trial-error attempts.
> 
> My remaining problem is, how to create parent folders for sub folders.
> 
> The uw-imap folder structure is flat (a list of files) so i would like
> to get related stuff into a tree structure using subfolders.
> 
> I got a bunch of --regextrans2
> 
> 	--regextrans2 's#^BURAPA$#Biker Stuff/BURAPA#' \
> 	--regextrans2 's#^BikeWeek$#Biker Stuff/BikeWeek#' \
> 	--regextrans2 's#^Biker Events$#Biker Stuff/Biker Events#' \
> 	--regextrans2 's#^Hard Rock$#Biker Stuff/Hard Rock#' \
> 	--regextrans2 's#^John Daytona$#Biker Stuff/John Daytona#' \
> 
> Resulting in correct created subfolders
> 
> 	user/testuser/Biker Stuff/BURAPA at example.com (\HasNoChildren)
> 	user/testuser/Biker Stuff/BikeWeek at example.com (\HasNoChildren)
> 	user/testuser/Biker Stuff/Biker Events at example.com (\HasNoChildren)
> 	user/testuser/Biker Stuff/Hard Rock at example.com (\HasNoChildren)
> 	user/testuser/Biker Stuff/John Daytona at example.com (\HasNoChildren)
> 
> Using Squirrel Mail as client, i would like to collapse those
> folders, to only show "Biker Stuff (unread/total)".
> 
> For this to work, i need the parent folder
> 
> 	user/testuser/Biker Stuff at example.com (\HasChildren)
> 
> To be created. I can do that manually in cyradm or Squirrel Mail, but there's
> too many parent folders needed for each user to do it by hand.
> 
> Any ideas as to how this can be done. Either by imapsync or some clever script?

+ I assume that you build the imapsync command by hand and type it in.
+ I assume that you have a copy of the imapsync command you used in a
file called '/tmp/cmd'.
+ I assume that you have one regextrans2 per line.
+ I assume that you only have one level of subfolders.

You can extract a list of "parent folders" from 'cmd' thusly (storing
them in '/tmp/parents'):

$ cat /tmp/cmd |sed -e 's!.*$#\(.*\)/.*!\1!' |sort -u > /tmp/parents


You can then create those folders on the uw-imap server by touching the
files:

$ cat /tmp/parents | xargs -n1 -d "\n" touch


You can then resync and the missing folders should be created.

Alternatively, instead of touching the files, you can build commands to
pipe to cyradm that will create the folders.






Regards,
@ndy

-- 
andyjpb at ashurst.eu.org
http://www.ashurst.eu.org/
0x7EBA75FF



More information about the Info-cyrus mailing list