Count the numbers of filename a folder with the same filename format

Hi Team,

Need some suggestion on how to read and count the files inside a folder with the same filename format.

for example, in folder A, I have 5 .pdf files.


I would like to get the actual count of “a” from that folder regardless of what the next string is. In this case, 2 files should be indicated on the output. I’ve been stuck here for a while and I can’t think of any work around to solve this.

Thank you very much in advance.

Hi @Iyce_Winsoft,

folderlocation->your folder path

IntFileCount=Directory.GetFiles(folderlocation, "a*.pdf").length


IntFileCount=Directory.GetFiles(folderlocation, "a*.pdf").Count


Missed ‘a’

Yes @vvaidya you are right I missed that.

Now I corrected in that post its self.
Thank you :slight_smile:

@arivu96 - Thank you. I got stuck on another task. will try this one for sure. will let you know. thank you very much. Cheers to all.


I am trying to get file list from the directory and its subdirectories but getting error as " illegal characters in file path". Can anyone suggest me how to deal with this error. Is there any way to catch this error?

Already solved this issue. Let me know if you need help.

1 Like