Check the extension of save attachments in folder

Hi sir/Madam
I have downloaded the attachment and now I need to check the extension of file saved in folder weather it is pdf or excels or something else how can I solve this
regards
Arjun

Use this code to get all files inside a particular folder,
ArrayOfString = Directory.GetFiles(“FolderPath”).
Then use a for each and inside for each use if condition as “item.Contains(“pdf”)”

but how do i check weather it is pdf or excel ??
@Manish540

Hi @arjun_27

You can download these codes.It will return the file type and some of the details of the file and from that you can do your desire checking.

cheers :smiley:

Happy learning :smiley:

3 Likes

Hi @arjun_27,

To get extension of file try the below code
Path.GetExtension(<filePath>)

1 Like

Thanks sir

1 Like

thanks sir :slight_smile:

no worries @arjun_27

cheers :smiley:

Happy learning :smiley:

3 Likes