Code here

<snip>

#!/usr/bin/perl

while(<>) {
chomp;
@f = split /\:/;

open(VPOP, "/home/vpopmail/bin/vuserinfo -d $f[0]\@bluetruck.net |") || die
"cannot execute vuserinfo ($!)\n";
$werd = <VPOP>;
chop($werd);
if ((-d $f[5]) && (-d $werd)) {
`cp -R $f[5]/Maildir/* $werd/Maildir`;
print "$f[5] $werd\n";
}
 else {
   if (!-d $f[5]) { print "dir does not exist in old email server
f[5]\n";  }
   if (!-d $werd) { print "file does not exist in new email server
$werd\n"; }
 }
}
<snip>

First needed to sed old vpasswd file...
I tar'ed it up and put it here so I have to add correct path to the old
vpasswd...
sed -e "s/\/home\//\/home\/oldemail\//g" vpasswd > vpasswd.new
mkdir /home/oldemail

on old email system..
tar -cf - /home/vpopmail/domains/muhdomain.com | ssh -l root
newmailserver.domain.com "cat > /home/oldemail/domain.tar"
this will tar and transfer the old email to the new server....

new server
cd /home/oldemail
tar -xvf domain.tar
which creates home/vpopmail/domains/muhdomain.com
now it looks like
/home/oldemail/home/vpopmail/domains/muhdomain.com

then I used the perl script above..

Thought I would send this to group just in case someone else needed to do
this....



Dev.



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 9:58 AM
Subject: Re: [vchkpw] move old mail to new dir layout


> Ya.  This shouldnt require a lot of tool creation on your part.
> vpopmail should have enough information and tools for this type
> of work, so you're lucky in that respect.
>
> Just think through it one step at a time, and you shouldnt have
> a problem getting it done :)
>
> Good luck!
>
> dev wrote:
> >
> > Yea it does...
> > Hehe forgot about vuserinfo....
> >
> > Over worked does this...
> >
> > Dev.
> >
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: "dev" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Wednesday, January 15, 2003 9:50 AM
> > Subject: Re: [vchkpw] move old mail to new dir layout
> >
> > > I see what you're trying to do.  I do 99% of the
conversions/migrations
> > > between mail systems here at Inter7, so I know your problem.
> > >
> > > Try writing a script:
> > >   * Get the next username
> > >   * Look up old directory
> > >   * Look up new directory
> > >   * Copy files
> > >
> > > You can get their old directory from the old vpasswd files, and do a
> > > vuserinfo | grep home | awk to get their current directory.
> > >
> > > Hope that helps.
> > >
> > > dev wrote:
> > > >
> > > > does anyone have or know of a way to cp -R user/Maildir/* to
> > > > new/location/user/Maildir/
> > > >
> > > > Is this possible without have to do it manually?
> > > >
> > > > We had a email system up forever using qmail+vpopmail etc. But the
old
> > > > system used vpasswd files and such.
> > > > I made a new system using MySql and spamassassin ...
> > > > But I had to add accounts before transferring it over. ALSO I
couldn't
> > just
> > > > tar the domain's dir because people are always getting emails and
tar
> > would
> > > > complain saying that a file was being writen to bleh bleh bleh.
> > > > So i made a script and just added everyone into the new system from
the
> > > > vpasswd file. BUT the dirs of the users are not in the same
location. SO
> > is
> > > > possible or does someone have a way to say read say the old vpasswd
and
> > then
> > > > find that users dir on the new system and then copy that users old
> > emails to
> > > > the new dir layout?
> > > >
> > > > Yes I know there is a vconvert. That will not work because all the
> > accounts
> > > > are already added.
> > > > I just need to move the users old mail from the old system to the
new
> > system
> > > > but I just can't tar and untar because directories are not in the
same
> > > > places now...
> > > >
> > > > Hope that makes sense...
> > > >
> > > > Dev.
> > >
> > > --
> > > mailto:[EMAIL PROTECTED]
> > > Matt Brookings - Chief Technical Officer
> > > Inter7 Internet Technologies, Inc.
> > > www.inter7.com - 847-492-0470
> > > Prices at http://www.inter7.com/prices
> > >
> > >
>
> --
> mailto:[EMAIL PROTECTED]
> Matt Brookings - Chief Technical Officer
> Inter7 Internet Technologies, Inc.
> www.inter7.com - 847-492-0470
> Prices at http://www.inter7.com/prices
>
>


Reply via email to