2017-02-27 74 views
1

我想寫一個簡單的文件移動循環,但我知道我錯過了幾件事情。 1.可能缺少經過所有文件的變量,即文本,只移動文本文件,因此我需要一個變量,但不知道我將它放在下面的代碼中。 2.我得到的錯誤消息是「必需屬性'源''沒有提供'MoveFilesPackage.LoopF​​ilesMove.MoveToDestination'...但我想我明白了嗎?我檢查了我的拼寫和大小寫......但仍然沒有顯示高達:( 讓我知道如果我缺少別的此運行的權利,並從一個目錄移動數據文件到另一個:( BIML代碼如下:BIML疑難解答文件移動

<Biml xmlns="http://schemas.varigence.com/biml.xsd"> 
<Connections> 
    <FileConnection Name="File_Source" FilePath="\\pc1\Documents\HMS\" RelativePath ="true"/> 
    <FileConnection Name="File_Destination" FilePath="\\pc1\Documents\HMS\Archive_Test\" RelativePath ="true"/> 
</Connections> 
<Packages> 
    <Package Name="MoveFilesPackage" ConstraintMode="Linear"> 
     <Variables> 
      <Variable Name="FileSource" Namespace="user" DataType="String"></Variable> 
      <Variable Name="FileDestination" Namespace="user" DataType="String"></Variable> 
     </Variables> 
     <Tasks> 
      <ForEachFileLoop Name="LoopFilesMove" Folder="User::FileSource" ConstraintMode="Linear" FileSpecification="*.txt"> 
       <Tasks> 
        <FileSystem Name="MoveToDestination" Operation="MoveFile"> 
         <Expressions> 
          <Expression PropertyName="Source" ExternalProperty="User::FileSource"></Expression> 
          <Expression PropertyName="Destination" ExternalProperty="User::FileDestination"></Expression> 
         </Expressions> 
        </FileSystem> 
       </Tasks> 
      </ForEachFileLoop> 
     </Tasks> 
    </Package> 
</Packages> 
</Biml> 
+0

foreachfileloop上的文件夾看起來不正確。它將得到'User :: FileSource'的字符串值而不是\\ pc1 \ documents ...看看我的文章[FileSystemTask](http://billfellows.blogspot.com/2014/02/ biml-file-system-task.html)雖然我沒有明確使用MoveFile操作,但它應該變得明顯 – billinkc

+0

確定找到1個修復程序,但得到不同的錯誤信息,說「System.collections.DictionaryEntry Exception類型:ExpressionSyntaxException C:\ ...等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等於自動規劃,達到並超過其許多相應的國家和地區的類似語言。 SteveB

回答

1

這是回答對Varigence BIML論壇,在那裏它被交叉發佈: https://varigence.com/Forums?threadID=9737

以下是提供的最小代碼示例:

<Biml xmlns="http://schemas.varigence.com/biml.xsd"> 
<Packages> 
    <Package Name="MoveFilesPackage" ConstraintMode="Linear"> 
     <Variables> 
      <Variable Name="SourceFilePath" DataType="String">c:\temp</Variable> 
     </Variables> 
     <Tasks> 
      <ForEachFileLoop Name="LoopFilesMove" Folder="\\pc1\Documents\HMS\" ConstraintMode="Linear" FileSpecification="*.txt" RetrieveFileNameFormat="FullyQualified"> 
       <VariableMappings> 
        <VariableMapping Name="0" VariableName="User.SourceFilePath" /> 
       </VariableMappings> 
       <Tasks> 
        <FileSystem Name="MoveToDestination" Operation="MoveFile"> 
         <VariableInput VariableName="User.SourceFilePath" /> 
         <ExternalFileOutput ExternalFilePath="\\pc1\Documents\HMS\Archive_Test\" /> 
        </FileSystem> 
       </Tasks> 
      </ForEachFileLoop> 
     </Tasks> 
    </Package> 
</Packages> 
</Biml>