Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Kd5I63N4VlJT+TYsAXZdqS
Power Automate - Building Flows
Answered

FORMS - COPY AND RENAME FOLDER IN SHAREPOINT

Like (1) ShareShare
ReportReport
Posted on 13 Mar 2025 15:21:55 by 4
Good afternoon. 
 
I want to take responses from a FORM to copy an existing folder, rename it as one of the responses, and drop it in another folder. 
There seems to be ways to do this but none that are working for me. 
 
Can someone point me in a direction of a good step by step for the most recent 2025 Microsoft 365?
 
Thank you!
  • AT-13031511-0 Profile Picture
    4 on 14 Mar 2025 at 13:10:31
    FORMS - COPY AND RENAME FOLDER IN SHAREPOINT
    Thank you @Michael E. Gernaey

    Your response was very informative and well laid out. 
    I tried your instructions quickly, but it did not work right away. I will try this weekend more

    Let me clarify a few things on my question...

    My form is an information input to create a new Project. I have linked the answers to create a task in my planner and send an email with the information. 
    The first question in my form is to put your "Initials - Job" .... example:  "AT - 12 Street Road"
    For my project folder, I use a Folder Template (zTEMP) that has an organization in it for all steps of the project. 

    I want to have the Form response 
    - Copy zTEMP from current location
    - Place into new location 
    - Rename to "AT - 12 Street Rd"
     
    To achieve this, it seems like my action just needs to be Sharepoint "Copy Folder". But that is not working. 
    After reading your steps and learning more on Power Automate in general... there is a lot I need to learn! 
     
    Thank you for your help
  • Verified answer
    Michael E. Gernaey Profile Picture
    35,938 Super User 2025 Season 1 on 14 Mar 2025 at 03:50:40
    FORMS - COPY AND RENAME FOLDER IN SHAREPOINT
     
    Hope to help, let me know if you have questions.
     
    So you want to copy an existing folder, which will be identified by a form answer?
    **I want to take responses from a FORM to copy an existing folder,
     
    Do you want to rename the Copy or rename the original?
    Do you mean, move the renamed (original folder), or renamed (copied folder?)
    **rename it as one of the responses and drop it in another folder. 
     
    Let's see if this helps you and you can come back and let me know what part is incorrect. Hopefully we can 
     
    Scenario
    Let's first pretend you have a Form 12345
    On the form you have a Question below
     
    Question 1: What Folder do you want to make a copy of?
    Answer: FolderToCopy
     
    Question 2: What folder would you like to copy this folder too?
    Answer: FolderToCopyTo
     
    In SharePoint you have the folder Foo
     
    Now, first let me explain what we need to do, then show you.
     
    1. Create a Flow with an Automated Trigger - When a Form is Submitted
    2. To make it clean, let's create a string Variable called CopyFolderName and we want to initialize it with the Dynamic Value of the Question for the Folder to Copy
    3. Let's create a second Variable called it - NewFolderName and we want to initialize it with the Dynamic Value of the Question for the Folder Copys Name
    4. Add a List Folder SharePoint Action
    --This will allow us to see if the Folder, that we want to save copies too, already exists.
     
    Now this is where it gets fun... You see, if the folder exists, you won't get an error. If it does NOT exist, you will get an error.
     
    So how do we handle this?
    Answer: we are going to configure Step 5 to only run if step 4 Fails
    Next, if Step 5 is skipped (because step 4 doesn't fail), we still need step 6 to run
    So we will configure it to run, whether Step 5 is Success or is Skipped
     
    This will make perfect sense in the visual section of this walkthrough.
     
    5. We will add our Create Folder Action
    -again we would only want this to Activate, if the previous step fails, telling us we need to create it, otherwise we would want to skip to step 6.
     
    Now we want to copy our folder, as we know our "copy to folder" exists for sure
    Now, to do this, we are doing to use the Get Metadata for the Folder. This is a good education piece as well. Just like files have Identifiers, so do Folders. Essentially, they are the same thing but for different object types.
     
    6, Add a Get Meta Data
    --Input our Site, and our Folder Path. The path will be a combination of your default root structure, like /Shared Documents and then we would put /VariableName, where the VariableName is the CopyFolderName that we created in step 2 above
     
    7. Now finally we do our Copy Folder
    Add a Copy Folder SharePoint Action
    --we fill in the site
    --but for the Folder (to copy aka source), we will use the Dynamic Property caled Id (not ItemId) from step 6. As a matter of fact, it will be one of the only things you even can add here
     
    And Done. Please see below for visual steps
     
    Here is my Sample setup for you
    Now here is my sample flow
     
    I created a Sample Form, with just 2 questions, Folder Name and New Folder Name. Now I don't know how you are doing it, if its a Single Select Choice or something but the result would be the same (a text answer)
     
    Next is my PA Flow - Part 1
     
    NOTE: Each part is just in order in the flow, so just build them in the order I have them here.
     
    1, I created my automated flow trigger
    2. I retrieved the response details
    3. I grabbed the answer to what folder to copy
    4. I grabbed the copied folder name to use

     
    Now for Part 2
    I created a SharePoint folder (so we could copy it) and added a couple of files
     
    Part 3
    So now we have to get the details for the folder we want and copy it.
    Now, we don't have any variables for the SharePoint site name, or Document library in this example, but that would be something you could do with Environment Variables
     
    Now we need to use the Get Metadata for the Folder so we can use the Id of the folder in our Copy
     
    Then I added my Copy Folder and in the Folder to Copy, i used the Dynamic Id property (not ItemId) from the Get folder metadata above it
     
    NOTE: and this is important to notice
    For the Site Address, since we didn't have Environment Variables, I just picked my Sites (and then blocked it out here)
    Next, I added the /Share Documents/  and then I added the proper Variable depending on whether I was pointing at the Source Folder, or the CopyToFolder
     
    Ok, so how did I add in the Parallel Action
     
    Under List Folder, I first Added Create new folder
     
    Now Part 2 of this though.
    Now click on the three ... on Get Folder Metadata and click Configure Run After. Make sure Only Success is checked. This makes sure this side only runs, 
     
    So before we see the steps in order lets see how i configured step 5 (Create new folder) and step 6 copy folder
     
    Click Configure to Run (this is for Create new folder) and its set to only run if List Folder Fails, which means the folder doesn't exist, so yes create it
     
    Now for Get Folder Metadata, which we want to run whether Step 5 runs or not because we need it to Copy the Folder property
     
     
    And Now the Steps in the flow 
     
     
     
    One this is one you can see that the Copy To Folder now exists (it did not on my first run) and it copied the Folder and its Sub-Parts (the 2 Files)
     
    Here is before and after pictures
     
    In picture 1 you can see I have no Folder called FolderToCopyTo
     
    Now after my run, it created the FolderToCopyTo folder, then copied FolderToCopy and its files under it.
     
     
     
    And Our full Flow
     
    Cheers, let me know if you need any more help
    -Michael

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

Thomas Rice – Community Spotlight

We are honored to recognize Thomas Rice as our March 2025 Community…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community

Announcing Our 2025 Season 1 Super Users!

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

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,508 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,386 Most Valuable Professional

Leaderboard
Loading started