How to Move Files Between Folders and Create New Folders If They Don’t Exist in Power Automate

In this tutorial, I’ll guide you through using Power Automate to move files from one folder to another in SharePoint. We'll also configure the flow to create a folder if it doesn’t already exist. Let’s get started!

Step 1: Set Up the Automated Cloud Flow


Step 2: Define Your Folder Structure

I have a folder named Directory in my SharePoint document library. This is where files will be moved.


Step 3: Add the “Move File” Action


Step 4: Extract Month and Year from the File Name

To create folders dynamically, extract the month and year from the file name using Compose actions and expressions:


Step 5: Dynamically Set the Destination Folder

In the Move file action, update the Destination Folder:

At this stage, the flow will fail if the folder does not exist. To fix this, we need to add logic to create the folder.


Step 6: Create a Folder If It Doesn’t Exist


Step 7: Move the File into the New Folder

After creating the folder, add another Move file action:


Step 8: Test Your Flow

To test the flow:


Final Thoughts

In this tutorial, you learned how to:

This approach can be extended to suit more complex folder structures or file organization needs. If you have any questions or feedback, let me know in the comments below!


Thanks for reading! Stay tuned for more Power Automate tips and tricks.