Skip to main content

Notifications

Community site session details

Community site session details

Session Id : +u9wBQBO+r0y8Z4NIRADJ4
Power Automate - Building Flows
Answered

Copy file from one SharePoint folder to another if the file name contains certain word

Like (1) ShareShare
ReportReport
Posted on 29 Aug 2022 12:47:04 by 17

Hi,

 

As the title suggests, I'm trying to copy files uploaded to one SharePoint folder to another if these files contain a specific text in their name. For example all files inside Folder A with names containing "What-If" will be copied to another folder named "What-If", files containing "Banquet Model" will be copied to a folder named "Banquet" etc. I tried different solutions posted in the forum but none of them seem to work. Any help would be greatly appreciated. TIA!

  • GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on 31 Aug 2022 at 06:19:11
    Re: Copy file from one SharePoint folder to another if the file name contains certain word

    Shouldn't be the case. Can you check the recycle bin of the SharePoint site via site settings if the is the file you are searching for ?

     

  • arit Profile Picture
    17 on 31 Aug 2022 at 04:35:01
    Re: Copy file from one SharePoint folder to another if the file name contains certain word

    Hi @GeorgiosG,

     

    I realized that the file from the source folder disappeared altogether after being copied to the new folder even though the action is set to "Copy file" not "Move file". I was wondering if you had any idea on what went wrong with the flow. Here's my flow: 

     

    copy.png

  • arit Profile Picture
    17 on 30 Aug 2022 at 13:03:29
    Re: Copy file from one SharePoint folder to another if the file name contains certain word

    Thanks @GeorgiosG!

     

    I've recreated this flow and it works.

  • Verified answer
    GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on 30 Aug 2022 at 06:06:51
    Re: Copy file from one SharePoint folder to another if the file name contains certain word

    Hi @arit ,

     

    if you are new to Power Automate I just recommend to just test things out 😉

    From the main logic it is the same what you want, instead of move file action simply use copy file.

    Trigger is changed from manually to When a file is uploaded, the construction with the condition is fine for your use case with two folder. 

     

    GeorgiosG_0-1661839449975.png

     

  • arit Profile Picture
    17 on 30 Aug 2022 at 04:45:14
    Re: Copy file from one SharePoint folder to another if the file name contains certain word

    Hi,

    Thank you for the reply. I'm completely new to power automate, so I'm still trying to navigate through and make sense of all the different elements. 

    Here are some more details if that helps: New files will be uploaded to the source folder constantly, so it won't be a one-time activity. Also, the file needs to be copied to the new folder not moved altogether. I'm trying to create a backup folder of some sort.

    Would it be possible to do this?

  • GeorgiosG Profile Picture
    1,013 Super User 2024 Season 1 on 29 Aug 2022 at 13:52:08
    Re: Copy file from one SharePoint folder to another if the file name contains certain word

    Hi @arit ,

     

    assuming that you want to do it just one time you can use the manual trigger. With the following process flow you can achieve this:

     

    - Manually Triggered

    - Get files (with filter which is checking your contains formulas)

    - move files (all files to the correct folder)

     

    I would work with scopes and copy them for all expressions. 

    In the filter you have to use FileLeafRef instead of Title. 

    Example:

     

    GeorgiosG_0-1661781061220.png

     

    GeorgiosG_1-1661781107410.png

     

     

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 14

#2
Churchy Profile Picture

Churchy 12

#3
rzaneti Profile Picture

rzaneti 10 Super User 2025 Season 1

Overall leaderboard
Loading started