title: Batch file to download a file with name that starts with a given string from FTP
body: <p>I use the following bat file:</p>
  
  <pre><code>::@echo off
  cd /d %0\.. 
  set cmd=%CD%
  
  echo user %~2&gt; %cmd%\ftpcmd.dat
  echo %~3&gt;&gt; %cmd%\ftpcmd.dat
  echo bin&gt;&gt; %cmd%\ftpcmd.dat
  IF NOT "%5" == "" echo cd %~5&gt;&gt; %cmd%\ftpcmd.dat
  echo get %~4 %cmd%\%~4&gt;&gt; %cmd%\ftpcmd.dat
  echo quit&gt;&gt; %cmd%\ftpcmd.dat
  ftp -n -s:%cmd%\ftpcmd.dat %1
  del %cmd%\ftpcmd.dat
  </code></pre>
  
  <p>Parameters and executions are like below:</p>
  
  <pre><code>c:\download.bat  ftpHost login password file.xml FTP_FOLDER
  </code></pre>
  
  <p>As you can see this script copy file with the specific name. </p>
  
  <p>How can I change this script to look for the first XML file that starts with a certain string. So instead of <code>file.xml</code> I want pass <code>beginning_of_the_string</code> (without <code>.xml</code>). Then script should copy the first of these files?</p>