重新路由文件和设置

若要重新路由文件和设置,请创建自定义 .xml 文件,并在 和 LoadState.exe 命令行上ScanState.exe指定 .xml 文件名。 自定义 .xml 文件允许将更改与默认 .xml 文件分开,以便更轻松地跟踪修改。

重新路由文件夹

以下自定义 .xml 文件将目录和文件从 C:\EngineeringDrafts 迁移到每个用户的 Documents 文件夹中。 %CSIDL_PERSONAL% 是表示用户>桌面项的<虚拟文件夹,等效于 CSIDL_MYDOCUMENTS

<migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="User">
  <displayName>Engineering Drafts Documents to Personal Folder</displayName>
  <role role="Data">
    <rules>
      <!-- Migrate all directories and files present in c:\EngineeringDrafts folder -->
      <include>
        <objectSet>
          <pattern type="File">C:\EngineeringDrafts\* [*]</pattern>
        </objectSet>
      </include>
      <!-- This migrates all files and directories from C:\EngineeringDrafts to every user's personal folder.-->
      <locationModify script="MigXmlHelper.RelativeMove('C:\EngineeringDrafts','%CSIDL_PERSONAL%')">
        <objectSet>
          <pattern type="File">C:\EngineeringDrafts\* [*]</pattern>
        </objectSet>
      </locationModify>
    </rules>
  </role>
</component>
</migration>

重新路由特定文件类型

以下自定义 .xml 文件将源计算机上的固定驱动器中的 .mp3 文件重新路由到 C:\Music 目标计算机上的 文件夹中。

<migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="System">
  <displayName>All .mp3 files to the Documents folder</displayName>
  <role role="Data">
    <rules>
      <include>
        <objectSet>
          <script>MigXmlHelper.GenerateDrivePatterns ("* [*.mp3]", "Fixed")</script>
        </objectSet>
      </include>
      <!-- Migrates all the .mp3 files in the store to the C:\Music folder during LoadState -->
      <locationModify script="MigXmlHelper.Move('C:\Music')">
        <objectSet>
          <script>MigXmlHelper.GenerateDrivePatterns ("* [*.mp3]", "Fixed")</script>
        </objectSet>
      </locationModify>
    </rules>
  </role>
</component>
</migration> 

重新路由特定文件

以下自定义 .xml 文件将 Sample.doc 文件从 C:\EngineeringDrafts 迁移到每个用户的 Documents 文件夹中。 %CSIDL_PERSONAL% 是表示用户>桌面项的<虚拟文件夹,等效于 CSIDL_MYDOCUMENTS

<migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="User">
<displayName>Sample.doc into the Documents folder</displayName>
    <role role="Data">
      <rules>
        <include> 
          <objectSet>     
                 <pattern type="File"> C:\EngineeringDrafts\ [Sample.doc]</pattern>
          </objectSet>
        </include>
       <locationModify script="MigXmlHelper.RelativeMove('C:\EngineeringDrafts','%CSIDL_PERSONAL%')">
        <objectSet>
                 <pattern type="File"> C:\EngineeringDrafts\ [Sample.doc]</pattern>
        </objectSet>
       </locationModify>
      </rules>
    </role>
</component>
</migration>