Delete all files and folders after connecting to FTP
<p>I want to connect through FTP to an address and then delete all contents. Currently I am using this code:</p>

<pre><code>from ftplib import FTP
import shutil
import os

ftp = FTP('xxx.xxx.xxx.xxx')
ftp.login("admin", "admin")

for ftpfile in ftp.nlst():
    if os.path.isdir(ftpfile)== True:
        shutil.rmtree(ftpfile)
    else:
        os.remove(ftpfile)
</code></pre>

<p>My problem is I always get this error when he is trying to delete the first file:</p>

<pre><code>    os.remove(ftpfile)
WindowsError: [Error 2] The system cannot find the file specified: somefile.sys
</code></pre>

<p>Anyone has an idea why ?</p>
