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 / How to wait until down...
Power Automate
Unanswered

How to wait until downloading files to finish on CMD?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, I'm making a PAD flow and I'm downloading some files from sftp server on CMD.

I just want flow to wait until downloading in done but nothing is working.

When downloading is done only sftp> shows up so I've tried to use wait for text on CMD, wait for text on window, wait for images, wait for text on screen, wait for process, and all using sftp as a trigger but nothing is working so far.

Is there any other ways to wait until downloading is done??

 

Thank you

I have the same question (0)
  • VJR Profile Picture
    7,635 on at

    Did you try the Wait for file?

     

    VJR_0-1664939903378.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Well I have thousands of files to download. Is there way to check if all of them are downloaded?

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Anonymous 

     

    You can use loop to iterate through each of filename and use the wait for file action suggested by @VJR  to check whether the files has been downloaded or not.

     

    Thanks & Regards,

    Nived N

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Can you:

    1) change your download folder?

    2) do you know the number of files before you download?

     

    My thought is get them to download into a folder that is emptied after they are processed and then simply "Get Files" and then you know how many have been downloaded with %Files.Count%, so you can Wait until Files.Count = the previous variable entered by the known total.

     

    If you can't change the download folder (i.e. there are existing files), use the same concept, but have a StartingFiles.Count variable to compare to each time you run Get Files.

     

    In both cases Get Files would be on a loop until Files.Count (or Files.Count - StarterFiles.Count) = how many downloads you expect.

     

    If you don't know how many downloads you expect, I have done something where it was on a loop:

     

    Loop

        Get Files to PreviousFiles

        Wait 30

        Get Files to NowFiles

        If PreviousFiles.Count = NowFiles.Count

            Exit Loop

        End (If)

    End (Loop)

     

    This means it will only move forward if no new file was downloaded in the past 30 seconds.  Obviously, you could change this to 1 minute or longer if they are big files.

     

    Best of luck!

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    Hi,

    Use dedicated FTP actions we have in PAD:

     

    https://learn.microsoft.com/en-US/power-automate/desktop-flows/actions-reference/ftp

     

    Or use dedicated CMD actions if for any reason you don't want to use dedicated "FTP" actions:

    From what you wrote it seems you are not using built-in "CMD Session" actions - give it a try

     

    1. Use "Open CMD session"

    2. Then use "Write to CMD session" - put all of the commands you normally do - this action will last until all of the commands are executed, I assume sftp command for downloading will keep this action "in progress" until it fully executes

    3. Use "Read from CMD session" if you need to read the otuput if there is any, but from what you write there is no output - so simply use "close CMD session" if there are no further commands to be executed

     

     

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 261 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 185

#3
Haque Profile Picture

Haque 168

Last 30 days Overall leaderboard