Power Automate:How to Move Files Between Folders in SharePoint|Move files from one folder to another

3 min read 8 months ago
Published on Sep 04, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Introduction

This tutorial will guide you through the process of moving files between folders in SharePoint using Power Automate. Whether you need to organize your documents or transfer files based on specific conditions, this step-by-step guide will help you effectively use the Move File action in Power Automate.

Step 1: Create a Flow

  1. Log in to your Power Automate account.
  2. Click on "Create" from the left navigation pane.
  3. Choose "Automated cloud flow" to start a new flow.
  4. Name your flow and select a trigger. For example, you can use "When a file is created or modified in a folder."

Step 2: Add the Move File Action

  1. After setting up your trigger, click on "New step."
  2. Search for and select "Move file" action from the list of available actions.
  3. Configure the following settings in the Move file action
    • Source Site Address: Select or enter the URL of your SharePoint site.
    • Source File Identifier: Use the identifier from the trigger (e.g., the file that was created or modified).
    • Destination Site Address: Select or enter the URL of the destination SharePoint site.
    • Destination File Path: Specify the folder path where you want to move the file.

Step 3: Handle Existing Files

If a file with the same name already exists in the destination folder, you have two options:

Option 1: Move with a New Name

  1. In the Move file action, you can modify the Destination File Path to include a unique identifier (e.g., timestamp) to avoid name conflicts.
    • For example, use the following format: Destination Folder/FileName_@{utcNow('yyyyMMddHHmmss')}.ext

Option 2: Fail the Action

  1. To ensure that the flow fails if a file with the same name exists, you can add a "Condition" action before the Move file step.
  2. Check if the file exists in the destination folder. If it does, configure the "If yes" branch to terminate the flow, indicating that the move has failed.

Step 4: Test Your Flow

  1. Click on "Save" to save your flow.
  2. Test the flow by creating or modifying a file in the source folder.
  3. Check the destination folder to confirm that the file has been moved as expected.

Conclusion

In this tutorial, you learned how to move files between folders in SharePoint using Power Automate. You also explored how to handle situations where a file with the same name already exists in the destination folder. For further learning, consider exploring other Power Automate actions to enhance your workflows. Happy automating!