New submission from Giampaolo Rodola' <g.rod...@gmail.com>:

>From RFC-3659:

   The MLST and MLSD commands are intended to standardize the file and
   directory information returned by the server-FTP process.  These
   commands differ from the LIST command in that the format of the
   replies is strictly defined although extensible.

The patch in attachment adds support for MLSD command.
This should ease the development of ftp clients which are forced to parse 
un-standardized LIST responses via dir() or retrlines() methods to obtain 
meaningful data for the directory listing.

Example:


>>> import ftplib
>>> from pprint import pprint as pp
>>> f = ftplib.FTP()
>>> f.connect("localhost")
>>> f.login("anonymous")
>>> ls = f.mlsd()
>>> pp(ls)
 {'modify': 20100814164724,
  'name': 'svnmerge.py',
  'perm': 'r',
  'size': 90850,
  'type': 'file',
  'unique': '80718b568'},
 {'modify': 20101207185033,
  'name': 'README',
  'perm': 'r',
  'size': 53731,
  'type': 'file',
  'unique': '80718aafe'},
 {'modify': 20100417183215,
  'name': 'install-sh',
  'perm': 'r',
  'size': 7122,
  'type': 'file',
  'unique': '80718b2d2'},
 {'modify': 20110129210053,
  'name': 'Include',
  'perm': 'el',
  'size': 4096,
  'type': 'dir',
  'unique': '8071a2bc4'}]
>>>

----------
files: ftplib_mlsd.patch
keywords: patch
messages: 127562
nosy: giampaolo.rodola, pitrou
priority: normal
severity: normal
status: open
title: Add MLSD command support to ftplib
versions: Python 3.3
Added file: http://bugs.python.org/file20623/ftplib_mlsd.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11072>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to