--- cyrus-imapd-2.3.7/tools/migrate-metadata    2005-12-01 23:30:22.000000000 +0100
+++ cyrus-imapd-2.3.7/tools/migrate-metadata.new        2007-10-08 16:15:35.000000000 +0200
@@ -151,16 +151,24 @@
     while ($subdir = readdir DIR) {
        my $subpath = $path . "/" . $subdir;
 
+       next if ( $subdir =~ /^[0-9]+\.$/ || 
+                 $subdir =~ /^\.\.$/ || 
+                 $subdir =~ /^\.$/ );
+       next if ( $subpath =~ /^\/socket$/ ||
+                 $subpath =~ /^\/stage\.$/ ||
+                 $subpath =~ /^\/sync\.$/ );
+
        if ($subdir =~ /^cyrus\.(.+)/s) {
            # cyrus.* file, see if we should migrate it
            if (defined($mfiles{$1})) {
+               # print "copy " . $part . $subpath . " to " . $mpart . $subpath ."\n";
                copy($part . $subpath, $mpart . $subpath) ||
                    ouch "couldn't copy $part$subpath to $mpart$subpath";
                unlink($part . $subpath) ||
                    ouch "couldn't delete $part$subpath";
            }
        }
-       elsif ($subdir =~ /^[^\.]+$/s) {
+       else{
            # no dot in name, so this is a subdir, process it
            mkdir($mpart . $subpath, 0700) ||
                ouch "couldn't create $mpart$subpath";
