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 / Automating SharePoint ...
Power Automate
Unanswered

Automating SharePoint File Movement Based on File Naming Scheme

(0) ShareShare
ReportReport
Posted on by 10

Hello Microsoft community!!

I'm seeking assistance with a task that requires moving specific files from one SharePoint folder to another based on our study naming scheme. I believe this is a task that can be automated, but I'm unsure how to go about it. Any guidance would be deeply appreciated, I havent been able to find any post that is completely relevant for what I need and I have spent 2 weeks on this. I have created a flow with really complicated variables & conditions, and I am unsure if I am going about this problem the right way (If you'd like to see what I have thus far I can post screenshots) Ideally I want this to be a manual trigger flow 

 

 

General file Structure:

  1. We have two main folders: "Active Studies" and "Closed Studies".
  2. Within each main folder, studies are grouped by ranges e.g., "S000-S099", "S100-S199", etc.
  3. Each range folder contains study-specific folders named as "S001", "S002", "S003", etc.
  4. Each study-specific folder should have a "statements and reports" sub-folder to store monthly statements and reports.

Task: Every month, we receive billing statements & reports for all active studies, and they're stored in a general "Billing" folder. These documents are named in the format "SXXX MONTH YEAR Statement.pdf" and "SXXX MONTH YEAR Report.xlsx".

I need to automate moving these files from the general "Billing" folder into their respective study folders under "statements and reports".

Example: A file named "S101 January 2023 Statement.pdf" in the general "Billing" folder should be moved to: "Active studies>S100-S199>S101>statements and reports".

 

 

Can someone guide me on how to create a flow in Power Automate that would help accomplish this task? I am at such a stall with this flow and any suggestions would be appreciated.

Thanks in advance for your help and guidance!

Categories:
I have the same question (0)
  • Unknown geen idee Profile Picture
    1,757 on at

    Dear M,

    This does not seem to be that difficult.

     

    The way how I would address this would be to build an array of all the locations with the names and the correct path.

    • Create an array variable.
    • Running a 'Get Files' action or something similar and filter out only the folders (there should be an 'IsFolder' element in the output you can use for this.
    • You will likely have to run the 'Get Files' action several times to go deeper into the folder structure and get everything. Basically this means that for every folder you find you run the 'Get Files' in that folder up until the point you do not find any more folders.
    • Append all results to the array variable including all foldernames and paths.

     

    Now when you get a new files, the only thing you have to do is filter the name of the file (or part of it) against the array-variable and the result will show you the path at which the file should be save ... save the file, move on to the next.

     

    Hope this helps,

    Happy flowing,

    Koen

     

     

     

  • Mc_squar3d Profile Picture
    10 on at

    Hi Koen! Thank you for your reply and I hope you're having a good week, it is nice to hear from a solutions sage and I hope you might be able to help me a little more...

     

    In my flow I do have a "get files" action for the billing folder, but I just "included nested items", does this achieve the same thing?

     

    OR Are you saying to run a "get files" action for the source (billing folder) and destination folder possibilities (active studies folder & closed studies folder)?

     

    and also - is the action "Get files (properties only)" the action you would use or is there a better "get files" action for my purposes?

     

    I attached a screen shot of my flow so far below, it's incomplete and nonfunctional (LOL) but I wanted you to have a visual of mine thus far to maybe give specific advice. This is my third go at it so the draft does not address everything I dont think, but I wanted to show you where I am standing at the moment. I may have too many variables... I am completely lost. If you'd like to see the other drafts let me know- but I am hoping to tweak this one per your advice.

  • Mc_squar3d Profile Picture
    10 on at

    Disregard this last msg- I think a copy migration of these files in retrospect may be more trouble than its worth.... I am going to now focus my energy on manually copying 😞 

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