title: Python get files from FTP wildcards and date changes using
body: <p>I need to find files by wildcards in FTP directory, and there are files in the directory with the same name parts (mask is specified for this part of the name) and need to find the file at a later date of modification. 
  Example: In the catalog there are files: AAA1, AAA2, AAA3, BBB1, BBB2. Looking for mask * AAA and BBB * files and AAAx BBBx a later date modification. </p>
  
  <p>That's what has turned out:</p>
  
  <pre><code>dir_source = ftp.nlst()
  masks = ["*.txt", "*.log"]
  
  def listFiles(files, masks):
      findFiles = []
      parrent = re.compile("|".join(map(fnmatch.translate, masks)), re.I).match
      for filename in filter(parrent, files):
          d = {filename: int((ftp.sendcmd('MDTM ' + filename))[4:])}
          print d
      findFiles.append(max(d, key=lambda i: d[i]))
      return findFiles
  
  print listFiles(dir_source, masks)
  </code></pre>
  
  <p>But it does not work... How to change the function?</p>