Returning a File Count from a Monitor

If you have a new question you’d like our support staff to post a response to, please visit our customer community, Data Security Insiders, to pose the question in our Discussion Boards. We have a thread “Ask Our Tech Experts” that our support team monitors on a regular basis, or you can start a new discussion where other GoAnywhere users and support staff can weigh in. Log in or create your new account at

If you need an immediate response, please create a support ticket or contact our support team by email at [email protected].
3 posts Page 1 of 1


Posts: 10
Joined: Mon Dec 05, 2016 12:12 pm

Post by Grodaes » Mon Jul 17, 2017 10:36 am

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?



Posts: 34
Joined: Mon Dec 01, 2014 10:35 am

Post by Support_Tim » Mon Jul 17, 2017 11:11 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.

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">
					<include pattern="*" />

		<forEachLoop itemsVariable="${fileList}" currentItemVariable="curFile" currentIterationVariable="fileCount" />
		<if condition="${fileCount >= 10}">

			<callModule label="Process Files" module="Process" version="1.0" />


	<module name="Process">

		<print version="1.0">
			<![CDATA[*************************************  ${fileCount} files found.]]>




Posts: 10
Joined: Mon Dec 05, 2016 12:12 pm

Post by Grodaes » Mon Jul 17, 2017 11:15 am
Hey! Thanks Tim this will be helpful.
3 posts Page 1 of 1