Returning a File Count from a Monitor
Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
3 posts
Page 1 of 1
Hello,
As the subject line suggests is there any way to do this? It would be nice to get more information out a file list (or even be able to use it as an array) after it is built. Basically we are looking at monitoring a system but only when it contains a specific number of files do we want to do our SFTP retrieve any chance the monitor can do this without us having to rebuild the list a second time?
Thanks,
Grodaes
As the subject line suggests is there any way to do this? It would be nice to get more information out a file list (or even be able to use it as an array) after it is built. Basically we are looking at monitoring a system but only when it contains a specific number of files do we want to do our SFTP retrieve any chance the monitor can do this without us having to rebuild the list a second time?
Thanks,
Grodaes
- Posts: 35
- Joined: Mon Dec 01, 2014 10:35 am
Hi Grodaes,
Thanks for your post.
Since the file list variable passed to the project contains a record, or row, for each file in the file list, you an use a For-Each loop in your project to count the files. Unlike the file list variable, there is not a variable passed to the project that contains a count.
The example below is a simple For-Each loop that has an Iteration Variable defined on the Advanced Tab. It just counts the loop.
I created a local file list, but this was just to test. You would be using the monitor's file list.
Example:
Thanks for your post.
Since the file list variable passed to the project contains a record, or row, for each file in the file list, you an use a For-Each loop in your project to count the files. Unlike the file list variable, there is not a variable passed to the project that contains a count.
The example below is a simple For-Each loop that has an Iteration Variable defined on the Advanced Tab. It just counts the loop.
I created a local file list, but this was just to test. You would be using the monitor's file list.
Example:
Code: Select all
<project name="Count Files in a List" mainModule="Main" version="2.0" logLevel="verbose">
<module name="Main">
<createFileList fileListVariable="fileList" version="1.0">
<fileset dir="C:\Program Files\Linoma Software\GoAnywhere54\userdata" recursive="true">
<wildcardFilter>
<include pattern="*" />
</wildcardFilter>
</fileset>
</createFileList>
<forEachLoop itemsVariable="${fileList}" currentItemVariable="curFile" currentIterationVariable="fileCount" />
<if condition="${fileCount >= 10}">
<callModule label="Process Files" module="Process" version="1.0" />
</if>
</module>
<module name="Process">
<print version="1.0">
<![CDATA[************************************* ${fileCount} files found.]]>
</print>
</module>
</project>
3 posts
Page 1 of 1