Hi
I have a Sharepoint folder that is added to regularly with different filenames. I need to copy these files in to new folders within another Sharepoint library based on part of the filename.
the files all have a fixed filename format as below:
Audit_Jobid_1234_Span_2345
Workpack_JobID_1234_span_2345
Consent__JobID_1234_span_2345
Audit_Jobid_1235_Span_2346
Workpack_JobID_1235_span_2346
Consent__JobID_1235_span_2346
And so on,
I need to create one new folder for each unique JobID with this number as the folder name and then copy all files from the source with the matching JobID in to the new folder either whenever a file is added to the Source(which is done automatically) or on a regular occurence(daily?)
Is this possible? I've tried all the suggestions on search forums but none quite seem to match the requirements.
Thanks
Hi @Chalky23456 ,
The codes I provided need to be paste in the input area directly rather than in expression input area. If the code is expression, it should be like below:
triggerOutputs()?['body/{Path}']
and
split(triggerOutputs()?['body/{Name}'],'_')[2]
Best regards,
Thank you for this, however when I try to use the split formula it tells me the expression is invalid?
Do I need to edit this to suit my files?
Hi @Chalky23456 ,
You can create an instant flow where help you make an initial folder structure and copy existing files for the first time. After the preparation is done, disable this instant flow and then create an automated flow that will be triggered by new file adding into the library.
folder path
@{triggerOutputs()?['body/{Path}']}@{split(triggerOutputs()?['body/{Name}'],'_')[2]}
Best regards,
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1