I would like to count the number of files in all the “Input” folders. Any idea how to do it fast? There can be situations like Child_2 folder where there are no files in its Input folder too.
In this scenario above, i would like to get a count of 3,as there is a total of 3 files in all the Input folders.
@Priyanka_Ramesh there might be situations where there are files also in the “Logs” folder. I do not want them to be counted. Only want those files to be in “Input” folders to be counted. Thanksss
To add to the solution given by @Priyanka_Ramesh, after you get the output of the code he provided, you can loop through the item list in the array, and check whether there are any files in the logs folder by checking the word “Logs” in each file path…
In the loop, get a count of files that reside in the logs folder based on the condition i mentioned, and subtract that from the total count
(Directory.GetFiles(Parent Folder,“*”, SearchOption.AllDirectories).Count ) - (Directory.GetFiles(LogsFolder,“Logs *”, SearchOption.AllDirectories).Count)
Can you try like this, I’m not sure if it takes from All log folders.