I am looking to solve an issue where I have multiple files in one folder and I need to find all the files beginning with “RWJBH_PB_BREG” as one attachment (NOT MULTIPLE). I tried using the For Each File in Folder Activity and looking for specific name, but issue is it sends multiple email (Using Send SMTP Mail) as opposed to one. Once it is done emailing I would like to archive these files under archive folder.
See the attached screenshot. All the highlighted I would like to send as part of one email attachment as opposed to multiple.
You can create an array and keep appending it in the loop with the file paths of the files whenever a match is found.
Move your archive folder and send email out of the current loop.
Outside the loop, use your send email activity and in its properties you will find attach collection option.
So, instead of attach files, you use attach a collection to upload items from your array variable there.
Then next loop to move files to archive folder.
Alternatively,
you can consider switching your first loop with directory.getfiles activity to fetch the list of the list that match the criteria.
And simply use its output to attach as a collection in send email activity.
Then only 1 loop to loop through this list to move files to archive.