Matching the name of a pdf file with a value from the Data Table

Hey there, I have several documents inside of a folder, differently named depending on the document type. For example:

  1. 12345_Contract.pdf
  2. 12345_Invoice.pdf
  3. 12345_Data_protection_agreement.pdf

Each documents has corresponding title, starting with Contract/Incoice/Data Protection Agreement. I need to loop through each document and check if the document name matches the title. I’m using Is Macth activity, returning bool variable, to be used in later step in an If activity.

Thanks in advance.

@akbar.huseynov

Welcome to the community

Use a for each file in folder activity with a if condition inside it for each file name that you need

Or use 3 for each file in folder loops with filter property on the file name

Cheers

hello,

–Use Assign activity–
–Directory.GetFiles(filepath,“*.pdf”).output of this arry variable

–pass that variable to for each, in for each use one assign activity–path.GetFileNameWithoutExtension(item.tostring)–output is string variable

–take if condition,
string variable.tolower.contains(“contract”)or string variable.tolower.contains(“incoice”)or
string variable.tolower.contains(“data protection agreement”).

cheers

Thank you for your responses. Sorry, assume initial description was misleading.

The task is, I need to go inside of each document and check if the document type from the file name - Contract/ Incoice/ Data_protection_agreement, match with the document type.

Fe: File 12345_Contract.pdf needs to contain word “Contract” inside of the file.

So far, I use For Each to loop through the files in the folder, and Is Match to look for the matches. I just can get the document type from the file name, to set it as a Regex for the search pattern.

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