Get the extensions of a file

Hi,

I need a function where I need to get extensions of a file .Based on the extension I need to perform set of steps

Hi @Naman_R

System.IO.Path.GetExtension(yourString)

Try to have it has .Tolower for safer side

This helps to get the file extension

Thanks
Nikhil

1 Like

@Naman_R

fileExtension = Path.GetExtension(filePath).ToLower()

1 Like

So let’s say you have multiple files inside a folder and you want to achieve a logic fr it

  1. Use assign activity :
    2.getFiles =directory.GetFiles(FolderPath)*
    FolderPath= Path of folder where your files are present
  2. Use for each activity
    Inside body of for each use if condition activity
    4.item.Contains(“.pdf”)* and so on …

Hi,

FYI, another approach using ForEachFileInFolder activity.

Regards,

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