Hello @MB69 There are multiple ways to implement this workflow using the SFTP - FTP connector depending on how frequently the files are uploaded and how big the file sizes are. I've put together the following workflow as a quick demonstration in hopes that it'll give you some ideas and get you started:
A few noteworthy items regarding this workflow are as follows:
- Trigger uses base64 encoding for keeping the data intact so be sure to use
base64ToString()
function to decode the data wherever needed. - The vendor list is stored in an array collection:
vendorCollection
- The vendor name is extracted from the trigger with
@{split(base64ToString(triggerOutputs()['headers']['x-ms-file-name-encoded']), '_')[0]}
and set as a value for the vendorName variable for reusability across subsequent actions. - Condition check whether
vendorName
exists in thevendorCollection
array. If true, workflow continues on to copy the file to a folder matchingvendorName
value and renames it withvendorName
followed by deleting the original file that was uploaded. - Condition to check is as follows:
@contains(variables('vendorCollection'), variables('vendorName'))
- RunAfter is configured across "Copy File", "Rename File" and "Delete File" actions so that they run one after the other sequentally
In my example workflow above, I only strip the prefix which is assumed to be the matching vendor name but you can make slight adjustments to it for any desired format -- let me know if any further assistance is needed ;)