Current time: 12-25-2024, 03:32 PM Hello There, Guest! (LoginRegister)


Post Reply 
[HowTo] Migrate folders from Uebimiau (VHCS2) to Squirrelmail (IspCP omega)
Author Message
mac86 Offline
Junior Member
*

Posts: 21
Joined: Aug 2009
Reputation: 0
Post: #1
[HowTo] Migrate folders from Uebimiau (VHCS2) to Squirrelmail (IspCP omega)
Hi,

this is how I get moved webmail users folders (sent, trash, and user custom folders) from VHCS to ISPCP

CAUTION: this code worked for me. If you want to use it, you have to check it. Consider like a ALPHA status pieces of code.

----

First, we have to create some folders inside /var/mail/virtual with next script.

Code:
#!/bin/sh

cd /var/mail/virtual/

for doms in `ls -1|egrep  '\.net|gov|com'`; do



        for i  in `ls -1 $doms` ; do
            echo "mkdir -p  $doms/$i/.Sent/cur"
            mkdir -p  $doms/$i/.Sent/cur
            echo "mkdir -p  $doms/$i/.Sent/tmp"
            mkdir -p  $doms/$i/.Sent/tmp
            echo "mkdir -p  $doms/$i/.Sent/new"
            mkdir -p  $doms/$i/.Sent/new
            echo "mkdir -p  $doms/$i/.Trash/cur"
            mkdir -p  $doms/$i/.Trash/cur
            echo "mkdir -p  $doms/$i/.Trash/tmp"
            mkdir -p  $doms/$i/.Trash/tmp
            echo "mkdir -p  $doms/$i/.Trash/new"
            mkdir -p  $doms/$i/.Trash/new
        done


done

echo "chown -R vmail:mail *"
chown -R vmail:mail *

Next, we have to move folders from vhcs2 to ispCP omega with next script:

Code:
#!/bin/bash

cd /var/www/vhcs2/gui/tools/webmail/database/

script="./script";
cat /dev/null > $script


for i in `ls -1`; do


        case $i in
                "_sessions") continue;
                ;;
                "_cached_templates") continue;
                ;;
        esac;

        dominio=`echo $i | awk -F_ '{print $2}' `
        usuario=`echo $i | awk -F_ '{print $1}' `

        ls -1 $i | while read  j; do


                case $j in

                        "inbox")        continue;
                        ;;

                        "_infos")               continue;
                        ;;

                        "_attachments")         continue;
                        ;;

                        "sent")         echo   "mv '$i/$j/'*  /var/mail/virtual/$dominio/$usuario/.Sent/cur/"
                                        echo   "mv -v '$i/$j/'*  /var/mail/virtual/$dominio/$usuario/.Sent/cur/"  >> $script
                                        continue;
                        ;;

                         "trash")       echo "mv '$i/$j/'*  /var/mail/virtual/$dominio/$usuario/.Trash/cur/"
                                        echo "mv -b '$i/$j/'*  /var/mail/virtual/$dominio/$usuario/.Trash/cur/" >> $script
                                        continue;
                        ;;


                esac;

                echo 'ANALIZANDO CARPETA  $j'

                echo "mkdir -p  '/var/mail/virtual/$dominio/$usuario/.${j}'"
                echo "mkdir -p  '/var/mail/virtual/$dominio/$usuario/.${j}'"  >> $script
                echo "mv '$i/$j/'* '/var/mail/virtual/$dominio/$usuario/.$j/'"
                echo "mv -v '$i/$j/'* '/var/mail/virtual/$dominio/$usuario/.$j/'"  >> $script
                echo

        done;

done


chown -R vmail:mail /var/mail/virtual/*

This code will create a script called "script" in your directory
/var/www/vhcs2/gui/tools/webmail/database

you must to run it with:

Code:
sh ./script

And hopellyfull you have in your squirrelMail your vhcs2 customers folders.

Smile
(This post was last modified: 10-07-2009 05:44 AM by gOOvER.)
09-15-2009 09:25 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)