Reputation: 113
I have written an ant script to transfer a single file using IBM WebSphere MQ File Transfer Edition.
<target name="filecopy">
<fte:filecopy src="${src}" dst="${dst}" idproperty="id">
<fte:filespec srcfilespec="${srcfile}" dstdir="${dstdir}"/>
</fte:filecopy>
</target>
For two files, the script would look like below:
<target name="filecopy">
<fte:filecopy src="${src}" dst="${dst}" idproperty="id">
<fte:filespec srcfilespec="${srcfile1}" dstdir="${dstdir1}"/>
<fte:filespec srcfilespec="${srcfile2}" dstdir="${dstdir2}"/>
</fte:filecopy>
</target>
How can I modify the script so that it can support multiple files by accepting a string (e.g. a.txt,b.txt,c.txt) as parameter?
Upvotes: 3
Views: 487
Reputation: 31832
How can I modify the script so that it can support multiple files?
Since your example already sends multiple files, presumably you are asking how to transfer a variable number of files to be determined at run time. There are a few options.
Based on the update, the requirement is to pass a string containing file names. Most likely, you will want to use Option #3 above. Pass the string of file names to something that can parse them, then generate the XML. This can be done with shell scripting, or in Ant using something like ant-contrib, or many other ways. There is nothing in the XSD for MQMFT that allows specification of file names natively as a delimited string.
Upvotes: 3