ファイルと設定の経路を変更する

ファイルと設定の経路を変更するには、カスタム .xml ファイルを作り、そのファイルの名前を ScanState と LoadState の両方のコマンド ラインに指定します。そのようにすると、変更を既定の .xml ファイルから分離して、変更の履歴を管理しやすくなります。

このトピックの内容:

  • フォルダーの経路変更

  • 特定のファイルの種類の経路変更

  • 特定のファイルの経路変更

フォルダーの経路変更

次のカスタム .xml ファイルは、ディレクトリとファイルを C:\EngineeringDrafts からすべてのユーザーのマイ ドキュメント フォルダーに移行します。%CSIDL_PERSONAL% は、[マイ ドキュメント] デスクトップ項目を表す仮想フォルダーで、CSIDL_MYDOCUMENTS と同じです。

<migration urlid="https://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="https://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="System">
  <displayName>All .mp3 files to My Documents</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 からすべてのユーザーのマイ ドキュメント フォルダーに移行します。%CSIDL_PERSONAL% は、[マイ ドキュメント] デスクトップ項目を表す仮想フォルダーで、CSIDL_MYDOCUMENTS と同じです。

<migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
<component type="Documents" context="User">
<displayName>Sample.doc into My Documents</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>

関連項目

他のリソース

USMT XML ファイルのカスタマイズ
競合と優先度
USMT XML リファレンス