title: Batch Script to Login into FTP Server and renaming the file in specific format
body: <p>Here is my scenario:</p>
  
  <p>I have files on FTP Server which needs to be renamed automatically.  I created a script to rename the file name as follows which is working perfectly on my computer:</p>
  
  <pre><code> @echo off
  setlocal
  for /f "tokens=2-7 delims=_.-" %%A in ('dir /B TACOS_*') do (
    setlocal enabledelayedexpansion
    call :getmonth %%B
    ren TACOS*_*%%A-%%B-%%C*_*%%D-%%E-%%F_UTC.csv TACOS_%%A!mon!%%C_%%D%%E%%F.csv
    endlocal
  )
  
  
  :getmonth
  if "%1" equ "Jan" set mon=01
  if "%1" equ "Feb" set mon=02
  if "%1" equ "Mar" set mon=03
  if "%1" equ "Apr" set mon=04
  if "%1" equ "May" set mon=05
  if "%1" equ "Jun" set mon=06
  if "%1" equ "Jul" set mon=07
  if "%1" equ "Aug" set mon=08
  if "%1" equ "Sep" set mon=09
  if "%1" equ "Oct" set mon=10
  if "%1" equ "Nov" set mon=11
  if "%1" equ "Dec" set mon=12
  goto :eof
  endlocal
  </code></pre>
  
  <p>Now I want to run this function on ftp by logging into the server.  For this I am using the following script:</p>
  
  <pre><code>FTP -s:ftpscript.txt
  </code></pre>
  
  <p>and the text file is </p>
  
  <pre><code>open 192.168.1.5
  ftp-user
  ftpuser
  cd reports/Don
  </code></pre>
  
  <p>The files are basically under Don directory which needs to be renamed using script above.   </p>
  
  <p>Questions:</p>
  
  <ol>
  <li><p>Do we need two scripts to handle this ?</p></li>
  <li><p>How can I get the rename done by logging into ftp server</p></li>
  </ol>
  
  <p>Help is much appreciated</p>