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 / Copying Files within a...
Power Automate
Unanswered

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:
I have the same question (0)
  • Verified answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 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

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 463 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 427 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard