I am trying to process specific files from a folder using assign activity but it does not work
Can anyone please help me with this issue?
Below are the screenshots
Hi,
Unfortunately, GetFiles doesn’t support regex filter as the following document.
Can you try to use LINQ as the following, for example.
System.IO.Directory.GetFiles(FilePaths1).Where(Function(f) System.Text.RegularExpressions.Regex.IsMatch(System.IO.Path.GetFileName(f),"(PAN|CHEQUE|GST).*.pdf|jpeg$")).ToArray
Regards,
2 Likes
Hi,
Hope the following helps you.
System.IO.Directory.GetFiles(FilePaths1)
means to return all files in FilePaths1 folder.
.Where(Function(f)
This means iterate the above files and filter out false item which the following expression returns
System.Text.RegularExpressions.Regex.IsMatch(System.IO.Path.GetFileName(f),"(PAN|CHEQUE|GST).*.pdf|jpeg$")).ToArray
This return true if the filename matches the regex pattern.
note: System.IO.Path.GetFileName returns just filename without directory.
As a result, we cam get files as if it were to use GetFiles with regex pattern.
Regards,
2 Likes
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.