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 containing ...
Power Automate
Unanswered

Copy files containing unique IDs in the filenames to existing folders with the same ID in the name

(0) ShareShare
ReportReport
Posted on by 2
Hi. I've found several posts similar to my situation, but none close enough for me to be able to use, so I'm really hoping someone is able to help me out.

Situation:
  • I have a flow which creates a batch of folders in the root of a library on our SharePoint site, each with unique access permissions based off staff information in a list.
  • I also have a different library on the same SharePoint site which contains confidential Word documents relating to each staff member.
What I need:
  • A manually triggered flow that will create a copy of each Word document in the folder with the matching ID.

The file names are formatted: '<last name>, <first name>, <staff ID>, <document type>'
The folder names are formatted: '<last name>, first name (<staff ID>) '
 
So for example I need the flow to copy file 'Bloggs, Joe, 123456789, personal info.docx' into folder 'Bloggs, Joe (123456789)'.
 
Is there any way this can be done? I assume it will need to involve the split function and one or two arrays, but I'm not quite sure how.

Any help would be hugely appreciated!
Categories:
I have the same question (0)
  • Korhanh Profile Picture
    20 on at
    Hello

    To copy Word documents into specific folders for each staff member in SharePoint using Power Automate, you can follow these steps:

    1. Create a New Flow with Manual Trigger.
    2. Define Variables for Document and Folder Names.
    3. Use the split() Function to Parse the Document Name (e.g., last name, first name, staff ID).
    4. Construct the Folder Name (e.g., <last name>, <first name> (<staff ID>)).
    5. Use the "Get files (properties only)" Action to retrieve documents and loop through them to copy into the appropriate folder.

    If you have an existing workflow you developed for this, could you share it with me? This way, we can try to find a solution based on that flow.

  • Suggested answer
    Meekou Profile Picture
    200 Moderator on at
    For your requirement to copy file 'Bloggs, Joe, 123456789, personal info.docx' into folder 'Bloggs, Joe (123456789)'., you will need to extract folder path and file name from 'Bloggs, Joe, 123456789, personal info.docx'.
    Try to follow steps eblow:
    • Add Compose to split the original file name by ,
    split(outputs('FileName'),',')
    • Add Compose to build the target folder name
    concat(outputs('Split_Path')[0],',',outputs('Split_Path')[1],'(',outputs('Split_Path')[2],')')
    • Add Compose to get filer name
    outputs('Split_Path')[3]
    Regards,
    Meekou
     
  • Ever Reddy Profile Picture
    2 on at
    @Meekou Thanks for your speedy reply, and my apologies if I'm missing something, but I'm relatively new to PA and it's my first time using the split function. I assume 'FileName' and 'Split_Path' in your example should be replaced with dynamic values, but I'm not quite sure which these should be?

    Could you also explain the steps you've given in the context of a flow that will be looking up all the files saved in one folder and copying each into it's individual named folder?

    I'm assuming the flow will need to look something like this?
     
     
     

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard