@@ -784,26 +784,32 @@ def RestoreEmails(self):
784784
785785 if self .mailFormat == cPanelImporter .MailDir :
786786 eUser .mail = 'maildir:/home/vmail/%s/%s/Maildir' % (items , it )
787- MailPath = '/home/vmail/%s/%s/Maildir/ ' % (items , it )
787+ MailPath = '/home/vmail/%s/%s' % (items , it )
788788
789789 command = 'mkdir -p %s' % (MailPath )
790790 ProcessUtilities .normalExecutioner (command )
791791
792+ command = 'rm -rf %s/Maildir' % (MailPath )
793+ ProcessUtilities .normalExecutioner (command )
794+
792795 MailPathInBackup = '%s/%s' % (FinalMailDomainPath , it )
793796
794- command = 'cp -R %s/* %s' % (MailPathInBackup , MailPath )
797+ command = 'mv %s %s/Maildir ' % (MailPathInBackup , MailPath )
795798 subprocess .call (command , shell = True )
796799
797800 else :
798801 eUser .mail = 'mdbox:/home/vmail/%s/%s/Mdbox' % (items , it )
799- MailPath = '/home/vmail/%s/%s/Mdbox/ ' % (items , it )
802+ MailPath = '/home/vmail/%s/%s' % (items , it )
800803
801804 command = 'mkdir -p %s' % (MailPath )
802805 ProcessUtilities .normalExecutioner (command )
803806
807+ command = 'rm -rf %s/Mdbox' % (MailPath )
808+ ProcessUtilities .normalExecutioner (command )
809+
804810 MailPathInBackup = '%s/%s' % (FinalMailDomainPath , it )
805811
806- command = 'cp -R %s/* %s' % (MailPathInBackup , MailPath )
812+ command = 'mv %s %s/Mdbox ' % (MailPathInBackup , MailPath )
807813 subprocess .call (command , shell = True )
808814
809815 ## Also update password
0 commit comments