2017-02-27 52 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>