web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Copy files and create ...
Power Automate
Unanswered

Copy files and create new folder within Sharepoint using part of filename(multiple filenames to one folder)

(0) ShareShare
ReportReport
Posted on by 4

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

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    on at

    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. 

    vjefferni_2-1700815570575.png

     

    folder path

    @{triggerOutputs()?['body/{Path}']}@{split(triggerOutputs()?['body/{Name}'],'_')[2]}

     

    Best regards,

  • Chalky23456 Profile Picture
    4 on at

    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?

  • v-jefferni Profile Picture
    on at

    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,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard