I have over 1200 files that have a staff number which is an 8 digit number beginning with 1 and which can be at various points within the naming convention of the file.
For example 12345678 John Doe.pdf or John 12345678 Doe.Pdf or John Doe 12345678 ABC.pdf.
I want to build a flow that will take the meta data of the file name and reconfigure the name so that the staff number is always first no matter where it appears in the original file's naming convention.
The flow will be as follows however I am not sure what the compose expression should be to handle the variable file name and also the variable file extension. Any assistance would be greatly appreciated.
I have used the following expression and it works but only when the staff number follows the first name and surname in the file naming convention
concat(
last(split(split(triggerOutputs()?['body/{FilenameWithExtension}'], '.')[0], ' ')),
' ',
first(split(split(triggerOutputs()?['body/{FilenameWithExtension}'], '.')[0], ' ')),
' ',
skip(split(split(triggerOutputs()?['body/{FilenameWithExtension}'], '.')[0], ' '), 1)[0],
'.',
last(split(triggerOutputs()?['body/{FilenameWithExtension}'], '.'))
)
Thank you in advance for any guidance / help you can provide.