according to the info i've got reply '211' like all the '2??' replies are
confirmation of a correctly completed command?
'stat' transfers its result over the control socket, i think retrlines is
looking for a result on the data socket, which is what the 'list' command
does, or 'nlst' which just includes file names.
so:
from ftplib import FTP
ftp = FTP('ftp.python.org') # connect to host, default port
ftp.login()
a=ftp.sendcmd('stat *',a.append)
ftp.quit()
print a
or for a list;
from ftplib import FTP
ftp = FTP('ftp.python.org') # connect to host, default port
ftp.login()
a=[]
ftp.retrlines('list *',a.append)
ftp.quit()
print a
or for a file name list;
from ftplib import FTP
ftp = FTP('ftp.python.org') # connect to host, default port
ftp.login()
a=[]
ftp.retrlines('nlst *',a.append)
ftp.quit()
print a
unfortunately none of these do a recursive search if you add the extension
,so 'nlst *.pdf' only searches the current directory, but your going to have
to manipulate the list returned anyway so filtering pdf is trivial.