Hints about a script that read ftp contents ....

conatic fa507874 at skynet.be
Thu Aug 7 16:37:18 EDT 2003


On Thu, 07 Aug 2003 00:29:21 +0100, simon place wrote:

> 
> On the ftp holding my web space (ftp server: ProFTPD 1.2.0pre10 ) a 'stat 
> *.pdf'  command will list all pdf files in all sub directories recursively, ( 
> and this is meant to be fairly standard,) unfortunately using ftp commands 
> directly shows up the server os dependent format that directories are listed 
> in ( usually UNIX ) but the functions to interpret this are in the ftp lib and 
> there's a more general interpretation module out there somewhere ( handles 
> more server os's )

With 'stat *.pdf' and classic ftplib I have this. Have you got same ?
WHere is the mistake ?

from ftplib import FTP
ftp = FTP('ftp.python.org') # connect to host, default port
ftp.login() 
ftp.retrlines('stat *.pdf') # list directory contents
ftp.quit()

-----------------------------------------------------------------------

>python -u ftp.py
Traceback (most recent call last):
  File "ftp.py", line 4, in ?
    ftp.retrlines('stat *.pdf') # list directory contents
  File "/usr/lib/python2.2/ftplib.py", line 402, in retrlines
    conn = self.transfercmd(cmd)
  File "/usr/lib/python2.2/ftplib.py", line 346, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "/usr/lib/python2.2/ftplib.py", line 330, in ntransfercmd
    raise error_reply, resp
ftplib.error_reply: 211-status of *.pdf:
211 End of Status
>Exit code: 1




More information about the Python-list mailing list