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 / Move Files between Fol...
Power Automate
Answered

Move Files between Folders based on File Extension

(1) ShareShare
ReportReport
Posted on by 10

 

Using Power Automate Desktop, how to I create a flow to move files between folders based on file extension? 

 

For example, I want to:

  • Move all .xlsx files into Folder 1.
  • Move all .ppt files into Folder 2.
  • Move all .pdf files into Folder 3.

 

Hope anyone can advise, thanks! 

 

 

 

  • DiegoEscobar1 Profile Picture
    13 on at

    Hello @superbackhand . You can use the trigger "When a file is created in a folder" and then use the "Switch" control comparing with the content-type output from the trigger (@{triggerOutputs()?['headers/Content-Type']})

    Here is the flow:

    DiegoEscobar1_0-1618775862099.png

    And here, the contect-type to compare with:

    • ppt: application/vnd.openxmlformats-officedocument.presentationml.presentation
    • xlsx: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    • pdf: application/pdf

    I used the notifications actions instead of the the "Move File" action below, just for simplicity.

     

    DiegoEscobar1_1-1618776138788.png

     

     Hope it helps!

     

    Regards.

    Diego.

      

  • Verified answer
    Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    There are two main methods:

     

    Method 1 - Get set of files by extension, and move them all

    You will need to Get files in folder with a file filter, and then Move files the %Files% variable.

    3 times, so 6 actions in total.

     

    Method 2 - Get all files, and loop through to move by extension

    You will need to Get files in folder without a file filter, and then a For each loop.

    In the loop, you can then use If conditional to check if %CurrentItem.Extension% equals .xlsx and so on.

    1 loop, 3 conditional blocks, so 11 actions long in total.

     

    Method 1 is cleanest, but method 2 is more versatile if there are more parameters of the files to be considered.

  • superbackhand Profile Picture
    10 on at

    Thanks @Henrik_M !! 

     

    I have tested both methods. The first one works. For the second one, it got stuck at the first loop and kept repeating there. 

     

    Am new to Power Automate, so have to figure out the basic functions too. 

     

    Method 1:

     

    image.png

     

    Method 2:

     

    image.png

     

     

  • superbackhand Profile Picture
    10 on at

    Thanks @DiegoEscobar1 

    This is using Flow on the site? I will try it as I go along, after I get more proficient on the Desktop Automate app. Thanks for the tip! 

  • DiegoEscobar1 Profile Picture
    13 on at

    HI!

    Yes, I am using Flow. Sorry I didn't see you wanted to use Power Automate Desktop.

    Anyway, if you are looking to do this tasks on cloud files like Ondrive or SharePoint, I recommend to use Flow.

    Regards.

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 302 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 263

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard