I have folder it has multiple files with different extensions. I wanted to filter only those files having extension .xls ,.txt ,.pdf irrespective of name of file. I am trying to setup the filter for it in activity for each file in folder. But control is coming out of the for each. I anticipated there is an problem in setting filter query. Can some one help me with how to set this filter query to filter out multiple extensions.
Appreciate for sharing approaches and thoughts well in advance.
Thanks
System.IO.Path.GetExtension(CurrentFile.ToString).Equals(".xls") Or
System.IO.Path.GetExtension(CurrentFile.ToString).Equals(".txt") Or
System.IO.Path.GetExtension(CurrentFile.ToString).Equals(".pdf")
Filter property in the For Each File in Folder activity does not support multiple extensions directly. So you will have to filter file using some other method as mentioned in the thread.
Just tried it out, you are right. I’m sure I have used this method for other activities with files and those worked perfectly. Shame it’s not supported on this one.
Hi @shivappa.katti1 try the below expression to filter
files = Directory.GetFiles(“YourFolderPath”).Where(Function(f) f.ToLower.EndsWith(“.xls”) Or f.ToLower.EndsWith(“.txt”) Or f.ToLower.EndsWith(“.pdf”)).ToArray()