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

uiautomation
activities
studio

#1

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.

a-1.pdf
a-2.pdf
b-1.pdf
c.1.pdf
d.1.pdf

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.


#2

Hi @Iyce_Winsoft,

folderlocation->your folder path

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

Or

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

Regards,
Arivu


#3

Missed ‘a’


#4

Yes @vvaidya you are right I missed that.

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


#5

@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.