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 folders within Sh...
Power Automate
Unanswered

Copy folders within SharePoint that begin with a certain name

(0) ShareShare
ReportReport
Posted on by

Hi Everyone,

 

I'm new to using Power Automate, but it has me intrigued and eager to learn more about it. I've searched online for similar examples but I don't see a clear answer to what I'm trying to do. It's probably fairly simple.

 

Want I want to do is build a flow which looks at and copies all folders (and it's contents) within a SharePoint document library that start with the name "ARC" to a second document library, while maintaining the original folder structure.

 

Example: When the flow runs:

 

It finds any folder starting with ARC in the SharePoint document library:

Document Library > My Folder 1 > ARC Documents

Document Library > My Folder 2 > ARC Administration

 

It will be copied to:

ARC Library > My Folder 1 > Documents (dropping the ARC if possible).

ARC Library > My Folder 2 > Administration (dropping the ARC if possible).

 

Any help would be appreciated.

Categories:
I have the same question (0)
  • v-litu-msft Profile Picture
    on at

    Hi @Anonymous,

     

    We could use the condition action to determine a file in the SharePoint if it is a folder by judge IsFolder property, it is a boolean type. Then determine the folder name whether contains "ARC Documents". If the two conditions met at the same time, copy folder to destination folder in the other SharePoint library.

    Annotation 2020-07-30 103448.jpg

     

    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.

  • Community Power Platform Member Profile Picture
    on at

    Thanks for taking the time to help me 

     

    I modified my flow just like the example you shown me. Using a condition for yes/no is a good idea. I was trying to filter my results by using the filter within "get files" itself.

     

    My flow seems to run, but it is giving me a false result at the condition, so the 'yes' action is not taken. In my test document library I have a folder with the name "ARC Documents", but it does not seem to locate it. Is there something I need to add to my "get files" action?

     

    Screen Shot 2020-07-30 at 9.56.54 AM.png

    Screen Shot 2020-07-30 at 9.56.15 AM.png

  • sebastian3 Profile Picture
    51 on at

    Hello,

     

    If you want to safe time and performance I would recomend filtering it within the get file(properties).

    I recently had some trouble with filtering foldernames as you can see in this thread. 

    https://powerusers.microsoft.com/t5/Building-Flows/Problems-filtering-the-Title-on-Sharepoint-Get-Files-Properties/m-p/642106#M85607

    You could try this to filter the folder.

    startswith(FileLeafRef,'ARC')

     

    Afterwards you can copy the folders.

  • Community Power Platform Member Profile Picture
    on at

    Hey sebastian3, thanks for the reply.

     

    That is what I was trying to do previously but I didn't know what the exact command was.

     

    I tried adding the string "startsWith(FileLeafRef,'ARC')" to the get files (properties) filter, but it says it's invalid. Should I add this as an initialize variable before the step?

  • sebastian3 Profile Picture
    51 on at

    You can't save the flow or waht exactdly is invalid?

     

    For me it works like this.

    sebastian3_0-1596119602978.png

     

  • Community Power Platform Member Profile Picture
    on at
    The message I get when running the flow is this:
     
    The function operator 'startsWith' is not supported or its usage is invalid.\r\nclientRequestId: 3c4dd7cd-435d-401c-89c2-75db298169f8\r\nserviceRequestId: 3c4dd7cd-435d-401c-89c2-75db298169f8
     
    Screen Shot 2020-07-30 at 10.40.13 AM copy.png

  • sebastian3 Profile Picture
    51 on at

    Hm it should be supported. See the documentation:

    https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests#supported-odata-query-options

    Maybe its casesensitive? Can you try to write everything small?

  • Community Power Platform Member Profile Picture
    on at

    I think you're right. I changed it to lower case and I didn't get any errors this time. Though it appears to have successfully run, it doesn't look like anything actually happened. The folder "ARC Documents" didn't get moved.

    Screen Shot 2020-07-31 at 10.14.22 AM.png

    Screen Shot 2020-07-31 at 10.17.40 AM copy.png

  • sebastian3 Profile Picture
    51 on at

    I was on vacation and didn't check this site out.

    Have you figured it out?

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