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 Automate
Answered

Wait for file

(1) ShareShare
ReportReport
Posted on by 19

Hi guys,

I have a file that is automatically download from a website. The file name contains 2 parts: the first part is a fixed word ('file') and  the second part is the time when the file was downloaded, for example: 'file_10.01.23_12_23'.

I want to create a flow on which the file is downloaded from website and then the next action is launch it in excel. The problem is that sometime the file is heavy and it takes too much time to download while the flow continue to work and then it misses the file when I ask him to 'get the files in folder'.

Somebody has an idea how can I make the flow wait for until the file is created and just then keep the next action?

For now, I just added the "Wait" action, but sometimes the file is too heavy and even the wait is over before it downloaded.

Thank you for your help!

I have the same question (0)
  • Highboy Profile Picture
    1,183 Super User 2024 Season 1 on at

    Use the Action "Wait for file"

    You can use it with or without a timeout.

    Highboy_0-1673353820903.png

     

  • MayShmulevich Profile Picture
    19 on at

    Hi, thank you for the reply! The problem is that I need to specify the full path, and I can not predict the name of the file, as the first time I download it is in the flow (the file name is not fixed). Any idea?

  • MayShmulevich Profile Picture
    19 on at

    I forgot to say that I did tried the "Wait for shortcut key", but its also not ideal, as I want the flow to run by himself

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    Get Files

    Set OldNumber to Files.Count

    Run the Flow

    Set NewNumber to Files.Count

    Loop While OldNumber = NewNumber

        Get Files2 (sort by date modified newest to oldest)

        Set NewNumber to Files2.Count

    End (Loop) 'this will end when there is one more file then there was previously.

    *now you can continue your loop with Files2[0] as the latest downloaded file.

     

    Best of luck!

  • MayShmulevich Profile Picture
    19 on at

    Such a great solution, thank you very much!!

     

  • RMsolutions Profile Picture
    4 on at
    hey everyone,
     
    I am having the same problem here but  @MichaelAnnis solution is not working for me, but it looks logically perfect
    maybe I am making a mistake
     
    I have a Flow where after several clicks and criteria entering, pressing download button and waiting
    the file is donwloaded always directly to downloads folder and it takes 5-300s depending on the criteria values
    as always, the are lots of files in downloads folder, random files
    here is part of the flow

     
    the downloaded file is always a string&date.xlsx
     
    I tried Wait for file  with file location in C:\Users\rober\Downloads\%DLfile%, where DLfile is a variable set at the beginning as 'string*'.xlsx - doesnt work, but this was an addition to the flow with the loop
     
    what the flow on the printscreen reallly does
     
    1. runs fine, clicks the download button and then web browser waits until the processing of data ends and the the downloads windows appears, but when I opened the download folder, as soon as the flow run to step 23 and starts the loop, it didnt wait until the file is downloaded, just moves the last file that existed before the flow ran
    2. then the flow finishes, the last file that existed before the flow ran was moved and the fresh downloaded file is in the downloads folder and appers depending to the size of the file in 5-300s or so
     
    inside get files is * the sort created DESC
     
    the flow doesnt wait for the file to be downloaded, it ignores the loop completely
     
    what am I doing wrong?
     
    thank you
     
    RM
     
  • Suggested answer
    SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
    try the following:
     
    • Trigger: Start download from the website.
    • Do Until:
      • Action: List files in the download folder.
      • Condition: Check if a file with "file_" in its name exists.
      • Delay: Add a short delay within the loop to avoid frequent checks.
    • Excel Action: Once the Do Until loop confirms the file, open it in Excel.
  • eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at
    @RMsolutions 
    Your Set variable OldNumber and NewNumber are just being set to be string of text: "Files.count"
    If you want to have the number of files the syntax is %Files.Count%

     
    It should look like this:

     
     
    The wait for file should work. Are you sure the value in Wait for file -actions File path -field was correct? Check the DLfile variables value when you run it and see if that actually has correct filename in it. For example if the file you are downloading is named "slovensko&31-10-2024" then you would do it like this:

     
     
    If you need to use the while loop then you should have Get files in folder -action before you download anything so you can get the "OldNumber" -variable value. Otherwise your download might have been quicker than expected and the file would have been downloaded before the While loop and there for it would stay in infinite loop.


  • RMsolutions Profile Picture
    4 on at
    @ eetuRobo
    thank you
    it was a mindless mistake setting as string
    I solved it yesterday with looking at the variable values and there was a string...
     
    well I do have the get the files at the start so I get the variable oldnumber first, the problem were the strings
     
    but the wait for file isnt working at all, I simply can not set a variable as fixed directory/string*.xlsx
     
    it is not working
     
    maybe bad syntax but cant find a good one with google
     
    thank you very much
     

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard