title: Batch script to wait for file to be generated on FTP server and download
body: <p>I have a program in my FTP server to generate a file, which may take 3-5 minutes to complete and also I knew the name of the file which i being created by my program. Now, once I initiate the program in my server, I have keep checking until the file is created. Once it is created, I am using the below batch script to ftp the file to my local desktop.</p>
  
  <pre><code>@ftp -i -s:"%~f0"&amp;GOTO:EOF
  open 10.100.16.111 
  username
  password
  lcd c:\
  cd  root/output_folder
  binary
  mget "*partial_file_name*" REM mget using wildcard search
  disconnect
  bye
  </code></pre>
  
  <p>This script works fine for me. But the problem is, I need modify this script as such, script should keep running until the file is generated. Because i don't know when the file creation will get completed. So, it will great if some one help/guide me to make a looping script which will wait until the completion of file creation and download the same file through FTP.</p>