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

Community site session details

Session Id : 3oOEzB/va3wVHBTTJZNg02
Power Automate - Building Flows
Answered

Automate moving files in SharePoint based on the file name

Like (0) ShareShare
ReportReport
Posted on 10 Mar 2020 06:54:45 by 3

I know this question has been asked in different ways but I can't seem to connect the dots for what I'm working on. Recently we started using teams. One of the things I was assigned to do is set up a channel for our managers to send their daily reports. The reports would then need to be filed in folders based on the area of responsibility associated with the report. 

 

So is it possible to have files moved to separate folders based on the name of the file? Example: 2nd Main or 2nd Refresh. If so will is it safe to assume each folder will require it's on flow?

 

Thank you for any assistance anyone is able to provide. I'm definitely out of my element. Somehow I've become the team IT guy because I figured out a few macros in excel. lol

  • Johnson23 Profile Picture
    35 on 26 Feb 2024 at 15:56:55
    Re: Automate moving files in SharePoint based on the file name

    @v-litu-msft 

     

    I want to do this as well but i want the file (created in SharePoint) to be moved to the file name's corresponding employee file folder in same SharePoint. Could you please help with this?

  • LSZC Profile Picture
    2 on 21 Dec 2023 at 15:06:22
    Re: Automate moving files in SharePoint based on the file name

    Hi,
    I have a same issue - I attached some screenshot, maybe this is something you can help with. As soon as I have 2 conditions, the second one never gets triggered.
    Best
    Laura

  • v-litu-msft Profile Picture
    on 11 Mar 2020 at 09:49:01
    Re: Automate moving files in SharePoint based on the file name

    Hi @NotJamez,

     

    It's weird, I test on my side but not have the same issue, how about using the string() function to convert the dynamic content and keywords into a string, or you could input the filename with extension in the left of the condition:

    Annotation 2020-03-11 150126.png

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • efialttes Profile Picture
    14,756 on 10 Mar 2020 at 19:42:46
    Re: Automate moving files in SharePoint based on the file name

    Hi

     

    Please add a Terminate action block with Status 'Succeeded' just after 'Move File 2' inside the true branch of your first Condition.

    https://powerusers.microsoft.com/t5/General-Power-Automate/Can-I-do-quot-Terminate-quot-action-as-quot-Successed-quot/m-p/14428

     

    Thanks!

  • NotJamez Profile Picture
    3 on 10 Mar 2020 at 18:41:43
    Re: Automate moving files in SharePoint based on the file name

    With only one condition it works great, but when I add the 2nd one I get the error below.

     

    Under Condition 2

    InvalidTemplate. Unable to process template language expressions for action 'Condition_2' at line '1' and column '2802': 'The template language function 'contains' expects its first argument 'collection' to be a dictionary (object), an array or a string. The provided value is of type 'Null'.'.

    Flow 1.PNG

     

    Flow 2.PNG

     

    Flow 3.PNG

     

     

     

  • Verified answer
    v-litu-msft Profile Picture
    on 10 Mar 2020 at 10:33:10
    Re: Automate moving files in SharePoint based on the file name

    Hi @NotJamez,

     

    Yes, you could use the Condition action to move the file if the filename contains the keywords, for example:

    If the filename contains keyword1, move it to Folder 1, or do nothing and perform the following condition to judge whether it contains keyword2, keyword3, etc.

    Annotation 2020-03-10 134146.png

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • efialttes Profile Picture
    14,756 on 10 Mar 2020 at 10:14:34
    Re: Automate moving files in SharePoint based on the file name

    Hi!

    "So is it possible to have files moved to separate folders..."?

    Were do the files come from? I mean, are they uploaded/created in the same source folder, and as soon as they are uploaded/createdyou need to move them to different folder, based on the name given?

     

    I am also assuming files are stored in Teams group related Sharepoint site, right?

    Hope this helps

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete