It initially seemed easy enough, but turned out it was not. I moved a customer to a new host, and she wanted a copy of all her emails on the old host.
So I ssh’d into both and copied over the /mail directory, which contained all her emails. Now I had a copy of all her email on the new server.
The mail directory structure is:
/mail
/.person2@domain-name_com
/.subdirectory-name
/cur
Within the cur directory are message files with names such as
1503689147.M825641P101251.box909.host-provider.com,S=16683374,W=16900128:2,RS
I tried using Filezilla to copy the whole directory structure, which it did, but there was an error with the file name, so it skipped all the message files. This gave me all blank message directories. I also tried an ssh scp copy, which gave me the same result:
/pc-dir/data//email/ /.person2@domain-name_com/.subdirectory-name/cur/1520784644.M399013P1031550.box909.host-provider.com,S=25262,W=25700:2,S: Invalid argument
Huh. The problem was that the file name contained a “:”, which gives Filezilla and SCP an error, which aborted the file transfer. The solution was to use ssh, go into each /cur subdirectory and do this command:
rename “:” “-” *
thereby replacing the file name’s “:” with a dash. This then allowed Filezilla to transfer the files. Make a copy of your email files before you try commands.
I tried: rename ‘s/:/-/g’ * but it did not work.