title: Delete files from ftp after download
body: <p>I am newbie to python and learning to delete the file which are downloaded from ftp site.</p>
  
  <pre><code>this is my error :OSError: [Errno 2] No such file or directory: 'RingGoData-2014-07-02.csv'
  </code></pre>
  
  <p>this is my code:</p>
  
  <pre><code>ftp = ftplib.FTP('192.198.0.20', 'bingo', 'Password')
  files = ftp.dir('/')
  ftp.cwd("/")
  #ftp.retrlines('LIST')
  filematch = '*.csv'
  target_dir = '/home/toor/ringolist'
  import os
  
  for filename in ftp.nlst(filematch):
      target_file_name = os.path.join(target_dir,os.path.basename(filename))
      with open(target_file_name,'wb') as fhandle:
           ftp.retrbinary('RETR %s' % filename, fhandle.write)
          if os.path.isdir(filename)== True:
               shutil.rmtree(filename)
           else:
               os.remove(filename)
  </code></pre>