1.Use the “Assign” Activity to Get Folder Paths: You can use the Assign activity to assign an array of folder paths. For example, you can assign an array with the paths to the “America” and “Australia” folders.
2.Iterate Through the Folder Paths: Use a For Each loop to iterate through the array of folder paths.
3.Use the “Directory.GetFiles” Method: Within the loop, use the Directory.GetFiles method to get a list of files in each subfolder.
4.Use the “Directory.GetFiles” Method: Within the loop, use the Directory.GetFiles method to get a list of files in each subfolder.
5.Count the Files: Use the .Count property on the list of files to determine the file count in each subfolder.
Assign rootFolderPath = "C:\Your\Root\Folder\Path"
Assign subfolders = Directory.GetDirectories(rootFolderPath)
For Each subfolder In subfolders
Assign currentSubfolder = subfolder
Assign folderName = Path.GetFileName(currentSubfolder) // Extract just the folder name
Assign fileCount = Directory.GetFiles(currentSubfolder).Count
Assign folderCountString = folderName + " - " + fileCount.ToString()
Log Message: folderCountString // Log the result
End For Each
For Each activity (item in folderPaths):
Assign activity: files = Directory.GetFiles(item)
Assign activity: folderName = Path.GetFileName(item)
Assign activity: fileCount = files.Count
// Now you can log or store the folder name and file count
Log Message activity: "Folder " + folderName + " - " + fileCount
// You can also store the results in a DataTable or a dictionary for further processing
This gives a dictionary…with key as the sub folder name and the value as count as you need
Directory.GetDirectories(rootFolder).ToDictionary(Function(subFolder) New DirectoryInfo(subFolder).Name, Function(subFolder) Directory.GetFiles(subFolder).Count)
Rootfolder is where you need to give the root folder value