ftplib and attributes

Michael Gilfix mgilfix at eecs.tufts.edu
Thu Apr 25 16:00:23 EDT 2002


  You get the attribute of files when you do a listing. For example:

    import ftplib
    ftp = ftplib.FTP ('ftp.somewhere.org')
    ftp.login ()
    listing = ftp.retrlines ('LIST')

    # Print your listing to look at it
    for i in listing: print i

  To get your attribute, first split the fields, for example:
  import string
  entry = listing[0]
  fields = string.splitfields ()

  You attributes will be in field[0]. You can then do any other
mining  you want. Hope that helps.

                       -- Mike

On Thu, Apr 25 @ 19:39, LoGan wrote:
> hi, im new bie and im trying to use ftplib, but my problem is to get the
> attributes of the files, how can i do ?
> LoGan
> -- 
> http://mail.python.org/mailman/listinfo/python-list
`-> (giannivolontosky)

-- 
Michael Gilfix
mgilfix at eecs.tufts.edu

For my gpg public key:
http://www.eecs.tufts.edu/~mgilfix/contact.html





More information about the Python-list mailing list