title: Delete local files after success FTP transfer
body: <p>I am writing a batch file that will do the following:</p>
  
  <ol>
  <li>Connect to remote FTP site</li>
  <li>Push all files from local director to remote FTP site</li>
  <li>Disconnet</li>
  </ol>
  
  <p>This works fine, <strong>but</strong> I also want to empty the local directory after upload (otherwise they will be transferred everytime). Unfortunately I have a problem where the connection to side might not always be possible, and thus if I add a crude del <em>.</em> to the end of my batch file, it will delete the files even if they havent been uploaded.</p>
  
  <p>Can anyone think of a way around this? i.e. If file uploaded then delete.</p>
  
  <pre><code>    @echo off
  cd \
  cd c:\temp
  echo user bacon&gt; ftpcmd.dat
  echo eggs&gt;&gt; ftpcmd.dat
  echo bin&gt;&gt; ftpcmd.dat
  echo put *.xls&gt;&gt; ftpcmd.dat
  echo bye&gt;&gt; ftpcmd.dat
  ftp -n -s:ftpcmd.dat &lt;Server&gt;
  del ftpcmd.dat
  </code></pre>