hi robin i fiddled around with your script a bit and came up with a workable solution. in case you want it, here it is... cheers mike ---- #!/usr/bin/perl #READ THIS FIRST OR SHIT WILL BREAK #usage ./box2dir.pl username #how i did my migration was i moved existing /var/mail #to /var/mail.old - so that's what this script refers to #IMPORTANT #if you run this as root, it mkdirs as root #i ran this in a batch script which chowns -R afterwards #its 2 in the morning - if you want to make it better, be my guest #disclaimer: if this breaks, you get to keep both halves #credit: robin whittle #mike bartlett (email address: mydigitalself at btopenworld.com ) require 'stat.pl'; #pull first argument into user variable $user = $ARGV[0]; printf("Checking or making maildir files...\n"); #check for the existance of the relevant directories #create them if they do not exist -e "/var/mail.old/$user" or die("Fatal: Old mailbox does not exist"); -d "/var/mail/$user" or mkdir("/var/mail/$user",0700) or die("Fatal: Unable to make /var/mail/$user/ subdirectory.\n"); -d "/var/mail/$user/tmp" or mkdir("/var/mail/$user/tmp",0700) or die("Fatal: Unable to make /var/mail/$user/tmp/ subdirectory.\n"); -d "/var/mail/$user/new" or mkdir("/var/mail/$user/new",0700) or die("Fatal: Unable to make /var/mail/$user/new/ subdirectory.\n"); -d "/var/mail/$user/cur" or mkdir("/var/mail/$user/cur",0700) or die("Fatal: Unable to make /var/mail/$user/cur/ subdirectory.\n"); printf("That went well! Now moving the mails...\n"); #the rest of this code was ripped from some other dudes code open(SPOOL, "/var/mail.old/$user") or die "Unable to open the mail folder\n"; $i = time; $mycounter = 0; while() { if (/^From /) { $fn = sprintf("/var/mail/$user/new/%d.$$.mbox", $i); open(OUT, ">$fn") or die("fatal: unable to create new message"); $i++; $mycounter++; next; } s/^>From /From /; print OUT or die("fatal: unable to write to new message"); } printf("Done. Moved $counter mail(s).\n"); close(SPOOL); close(OUT); exit 0;