For Each Folder

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].
2 posts Page 1 of 1


Posts: 12
Joined: Mon Jun 22, 2015 12:41 pm

Post by jlee1 » Tue Feb 16, 2016 11:31 am

I'm trying to create a project to determine how many files are in each folder. I have a folder with around 50 sub folders that contain files. Is there a way for me to loop through each folder and count the files in each folder? I can't seem to create a list of folders.



Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Thu Feb 18, 2016 9:09 am
There are several ways you can accomplish this:

Creating a File list (createFileList) will allow you to point to the root folder, then add a Recursive view. This will traverse all folders (below the root) and return a list of files. An optional variable is the Number of files found. This will give you the TOTAL number of files (in all folders).

To separate by sub-folder, you would have to loop through (forEach) the FileList variable and check for a change in the file attribute "parentFile" (This is the current folder of each file as you loop through.) Create a counter and then you would have the number of files in each folder.

Another way is to use a Folder List. This is detailed with a Forum Post Here.

Creating your folder list would allow you to loop through that rowset of Folder Names, then do a CreatFileList inside each folder to generate the number of files in each.

There are other options as well ... these are just a couple.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts Page 1 of 1