Forum Discussion

LouisT645's avatar
LouisT645
Copper Contributor
Dec 28, 2023

Optimize loop Flow

Hi all,

 

I have a Power Automoate flow that I use to move files from one folder to another.
I check whether the folder number in a "Number" column corresponds to the column in another folder to ensure that the moved file ends up in the right folder.
I therefore have a condition in my Power Automate flow that loops over all the folders until it finds a match before moving my file.
The problem is the execution time. It takes about 2 minutes for the flow to run. How can I optimise this?

  • Jon_Lake's avatar
    Jon_Lake
    Brass Contributor

    Hi LouisT645 , have you considered using an expression to generate the destination folder path and moving based on that, avoiding the condition? I appreciate you may be wanting to ensure a destination folder exists.

    • LouisT645's avatar
      LouisT645
      Copper Contributor
      Hi, thank you for the answer. What do you mean with the condition?
      The fact is that I really need to know if the folder is already created, if not I send an error message to the team to avoid the files everywhere
      • Jon_Lake's avatar
        Jon_Lake
        Brass Contributor

        Hi LouisT645 , my initial interpretation of your question was that the source folder name is numbered. Using that number you could avoid questioning whether the destination folder exists, but I'm now doubting my understanding. Can you expand the detail of the source files/folders and the destination folders?

Resources