title: How to delete all files of a FTP folder using batch
body: <p>I searched from several posts to find the solution for this problem but couldn't find it. I want to build a Batch file that goes to a folder on a FTP and Download all the records then Delete all of them. </p>
  
  <p>So far I tried to Use the command "mdel <em>.</em>", please see the code below:</p>
  
  <pre><code>@echo off
  echo user ftpUser&gt; ftpcmd.dat
  echo Password&gt;&gt; ftpcmd.dat
  echo cd /tst/&gt;&gt;ftpcmd.dat
  echo binary&gt;&gt; ftpcmd.dat
  echo prompt n&gt;&gt; ftpcmd.dat
  echo mget *.*&gt;&gt; ftpcmd.dat
  echo mdel *.*&gt;&gt; ftpcmd.dat
  echo quit&gt;&gt; ftpcmd.dat
  ftp -n -s:ftpcmd.dat 77.99.999.999
  del ftpcmd.dat
  </code></pre>
  
  <p>For this solution I noticed that if i use the command "delete" and specify the file it works. Like this:
      echo delete 312312312.csv >> ftpcmd.dat</p>
  
  <p>But for some reason using mdel(like the example) it doesn't.</p>
  
  <p>Do you know a better way to make it works? </p>
  
  <p>Thanks</p>