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