Regexp not performing the same in FTP versus Python

IamIan iansan at gmail.com
Thu Feb 8 18:49:56 EST 2007


Hello all,

I'm trying to use a regular expression in an FTP script to list
certain files. When run in a standard FTP session the command:

dir ????????.??[oOdDnNmM]*

returns 48 files. When I use the following Python script it prints
roughly 12 files (a subset of the 48), ending with 'None':


import ftplib, traceback

ftp = ftplib.FTP('host')
ftp.login(user='user', passwd='pass')

try:
  admFiles =  ftp.dir('????????.??[oOdDnNmM]*')
  print admFiles
except:
  traceback.print_exc

ftp.quit()


Is my Python syntax off?

Thank you.




More information about the Python-list mailing list