Pdf files in a folder

Hey everyone!

So, I’m working on a project and I need to figure out if there are any .pdf files in a particular folder.
I’m not sure of the best way to check for them.

Any suggestions or methods you’ve used before to handle something like this would be super helpful!

Hi,

How about the following?

files = System.IO.Directory.GetFiles("yourFolder","*.pdf")

Regards,

Hi @Chhavi_Balhara

Try this way in the IF condition

System.IO.Directory.GetFiles("D:\Testing_Purpose\New folder\","*.pdf").Count>0

Regards,
Gowtham K

Hi @Chhavi_Balhara

This code checks if there are any .pdf files in the C:\Test folder:
Directory.GetFiles(“C:\Test”, “*.pdf”).Length > 0
• It searches for .pdf files in the folder.
• If the count of files is greater than 0, it returns true (files exist), otherwise false.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.