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 / Recursively Move files
Power Automate
Unanswered

Recursively Move files

(0) ShareShare
ReportReport
Posted on by 6

Hi

 

I'm new to power automate and seem to be struggling with something that is very easy to do in other programming languages. I would normally just move files from /updated/ to /live/ but I can seem to copy recursively to sub directories.

 

I have folder permissions set up for users on the "live" directory folders so do not want to overwrite this each time.

I want to move new files into an existing file structure, the folder structure I'm moving from matches the one I'm moving too.

 

For example

Live reports sit in

/live/report1folder/reportX.xlsx 

/live/report1folder/reportY.xlsx 

/live/report2folder/reportS.xlsx 

/live/report2folder/reportP.xlsx

 

Each month I want to be able to upload the below and run a flow to move the files from /updated to /live

/updated/report1folder/reportX.xlsx 

/updated/report1folder/reportY.xlsx 

/updated/report2folder/reportS.xlsx 

/updated/report2folder/reportP.xlsx

 

I've tried a few examples with List File properties and parameterising but can't get them to do the job.

 

Is this possible?

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

    Hi @Rhys 

    According to your description, you want to move the files from Update folder to live folder and preserve the files structure. If any misunderstanding, please kindly let me know.

    I set up a flow, you can refer to below screenshots to see if it helps.

    vLilyWmsft_0-1645073223989.png

    vLilyWmsft_1-1645073236881.png

    vLilyWmsft_2-1645073247708.png

    vLilyWmsft_3-1645073261808.png

    Expression:split(outputs('Compose'),'/')

    vLilyWmsft_4-1645073278579.png

    Expression:last(take(outputs('Compose_3'),add(length(outputs('Compose_3')),-1)))

    vLilyWmsft_5-1645073313291.png

    vLilyWmsft_6-1645073368698.png

    After Flow runs, the file in Updated folder will be moved to live folder.

    vLilyWmsft_8-1645073475155.pngvLilyWmsft_7-1645073448466.png

    Hope the content above may help you.

    Best Regards

    If my reply helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Rhys Profile Picture
    6 on at

    Hi

    You logic has helped me massively however my data sits in nested folders which I think makes this a bit easier. I just need to add a condition to check if folder contains any files as well as if its a folder as it fails when looping over report1folder.

     

    So I've adjusted what you have given me, on compose 2 I'm doing a

    replace(outputs('Compose'),'updated/','')
    and then using this as the new folder path as the copy to location

     

     

    updated example

    Live reports sit in

    /report1folder/subfolder1/reportX.xlsx 

    /report1folder/subfolder1/reportY.xlsx 

    /report2folder/subfolder2/reportS.xlsx 

    /report2folder/subfolder2/reportP.xlsx

     

    Each month I want to be able to upload the below and run a flow to move the files from /updated to /live

    /updated/report1folder/subfolder1/reportX.xlsx 

    /updated/report1folder/subfolder1/reportY.xlsx 

    /updated/report2folder/subfolder2/reportS.xlsx 

    /updated/report2folder/subfolder2/reportP.xlsx

     

     

     

     

     

     

  • Rhys Profile Picture
    6 on at

    I've accepted your answer as it worked for the example.

     

    For nested folder's I went with this.

    Rhys_0-1645096901252.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

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard