Index: mod/resource/backup/moodle1/lib.php
===================================================================
--- mod/resource/backup/moodle1/lib.php	(revision 9031)
+++ mod/resource/backup/moodle1/lib.php	(working copy)
@@ -191,8 +191,18 @@
         }
         $this->fileman->filearea = 'content';
         $this->fileman->itemid   = 0;
+        //M:: bug 1961 -- Mon March 12, 2012
+        //backup/restore from M1.9 to M2.x does not preserve linking between resources
+        // This section tries to fix that.
+        $curfilepath = '/';
+        if ($reference) {
+            $curfilepath = pathinfo('/'.$reference, PATHINFO_DIRNAME);
+            if ($curfilepath != '/') {
+                $curfilepath .= '/';
+            }
+        }
         try {
-            $this->fileman->migrate_file('course_files/'.$reference, '/', null, 1);
+            $this->fileman->migrate_file('course_files/'.$reference, $curfilepath, null, 1);
         } catch (moodle1_convert_exception $e) {
             // the file probably does not exist
             $this->log('error migrating the resource main file', backup::LOG_WARNING, 'course_files/'.$reference);
