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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Copying Files within a...
Power Automate
Answered

Copying Files within a Directory

(0) ShareShare
ReportReport
Posted on by 113

Hello Power Automate wizards,

 

I have some a SharePoint Site and under Documents, I have many sub folders that each have a MS Word document that I would ultimately like to, at the push of a button, a PowerApp would pass an Event Name that is manually entered by a user, then copy the MS Word document that is in each folder into the same folder with the Event Name + the original file name. 

Here is how that SharePoint Library looks:

TimDemma_0-1714500212355.png

So Sub Folder 1, 2, and 3 each has a word document which is a template that is used during outage or other crisis management situations. 
So, when I (or a member of my team) pushes the button, the word document in each folder would copy itself and replace the name the file with the event name + the original file name (i.e. Event 1 - Responder Document.docx).

When I start creating the Power Automate Flow, this is what I have built:

TimDemma_0-1714500868129.png

 

When I run a test on this flow, I get an error in the copy file step that can't verify the "Destination Site Address" even though it matches the "Current Site Address" of the file I am trying to copy....

Any suggestions of a better way of doing this would be appreciated. This seems like a very easy task to do, but I am running into road blocks.

 

HALP

Categories:
  • Verified answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @TimDemma 

     

    Try like this 

    Nived_Nambiar_0-1714541722410.png

    Expression - 

    replace(items('Apply_to_each')?['{FullPath}'],concat('/',items('Apply_to_each')?['{FilenameWithExtension}']),'')

     

    I am just removing filename part from full part so to get the folder path only (without / at the end)

    This works, But with Copy with New, it adds up a number at end to the file, as in your case, File name should be EventName_Filename format, so i would suggest another approach here 🙂

     

    Nived_Nambiar_1-1714541935498.png

     

    First get the file content of currently iterating file and then use its content to create file with name EventName_FileName using create file option

    Nived_Nambiar_2-1714542004521.png

     

    FolderPath expression - 

    replace(items('Apply_to_each')?['{FullPath}'],concat('/',items('Apply_to_each')?['{FilenameWithExtension}']),'')
     
     Nived_Nambiar_3-1714542066158.png

     

    File Name expression - 

    concat(triggerBody()['text'],'_',items('Apply_to_each')?['{FilenameWithExtension}'])
     
    Hope this helps !
    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌


  • TimDemma Profile Picture
    113 on at

    Thanks so much @Nived_Nambiar ! 

    I used the "concat" function you mentioned, tweaked it just a hair and managed to get the exact result I was looking for!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 211 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 190

Last 30 days Overall leaderboard