For Each Folder

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

jlee1

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

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

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.

Thanks!

Support_Rick

Support Specialist
Posts: 590
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