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 / Automating Movement of...
Power Automate
Unanswered

Automating Movement of Folders

(0) ShareShare
ReportReport
Posted on by 10

Hello Power Automate Community!

 

I am trying to move folders in one folder to another folder in the same folder. 

 

I know that Power Automate has the "move folder" function but my situation is a bit more complicated than that. 

 

For example, the main folder will have folders entitled "130", "140", and "150". The main folder will constantly be receiving downloaded content as new folders and they will be called, for example "130_helloworld". This folder would need to automatically move to the parent folder of "130". Is there a way to ask Power Automate to scan all the folders in the parent folder (where folders "130", "140", and "150" are located) and then scan if there are any folder with the same name but have an underscore after it (e.g. 130_helloworld) and move it to folder "130". 

 

Thanks a lot and any help would be highly appreciated!

 

Best,

Shant 

Categories:
I have the same question (0)
  • ccc333ab Profile Picture
    1,144 on at

    Here would be an approach, but have one assumption in this soclution. That is, the naming convention of your folders that will get added in will alwaysbe "###_Name of your new folder". They key here is the underscore. 

     

    1. Use trigger "When a file is created (properties only)" to trigger flow when a folder is added. 

    2. I am checking to see if the item added is a folder, and that the filename has an underscore in it. If it doesn't, then don't do anything. 

    ccc333ab_1-1624166253820.png

    Note: The No side of this condition is blank.

     

    3. Using a Compose just to extract out the text to the left of the underscore. (I'll use 135_NewOne for this example). 

    ccc333ab_2-1624166336167.png

     

    first(split(triggerOutputs()?['body/{FilenameWithExtension}'],'_'))

    4. Find the folder with the text found on the left hand side of the underscore (i.e., 135), with a Get files (properties only). This is done with a Get files (properties only) and using a filter query. 

    ccc333ab_3-1624166495134.png

    5. And finally, do the move folder step. This will be in an Apply to each loop because of the Get Files query, but you should only ever get 1 folder from your filter query. 

    ccc333ab_4-1624166669786.png

    Notes: When selecting the dynamic content for the folder to move and destination folder, make sure you use:

    • Folder to move: Use the Identifier from the trigger (When a file is created step)
    • Destination Folder: Use Folder Path and Name from Get files (properties only) 
  • postproduction Profile Picture
    10 on at

    Thanks a lot for your comprehensive answer!!! This all makes sense to me but are you executing the above on a cloud environment and using sharepoint? I would like to do so on a desktop environment but cannot find the same triggers. Do you know how to do it on a desktop environment? 

     

    Thanks a lot and looking forward!

     

    Best,

    Shant 

  • ccc333ab Profile Picture
    1,144 on at

    Sorry, yes, this was a Power Automate solution, and I actually haven't used Power Automate Desktop so can't help you out. 

     

    Your best bet would be to post this question in the "Power Automate Desktop" forum. 

  • Matt44 Profile Picture
    2 on at

    Hey @ccc333ab, within the condition what expression did you input to get the "true" for IsFolder > is equal to > .

     

    Thanks.

  • ccc333ab Profile Picture
    1,144 on at

    The expression is exactly as displayed, checking to see if IsFolder is equal to true. Make sure to: 

    • Use "IsFolder" from the list of dynamic properties from the trigger (which is When a file is created (properties only)
    • Create the true value as an expressino (click the of the trigger "When doing this, make sure you type in "true" as an expression 

    ccc333ab_0-1681396347098.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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 398 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 323 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 183 Most Valuable Professional

Last 30 days Overall leaderboard