469,362 Members | 2,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

Re: Distinguish file and folder on ftp site

Il giorno gio, 14/08/2008 alle 10.08 +0200, Fredrik Lundh ha scritto:
Mailing List SVR wrote:
is there a simple way to do this?

ftplib seems unable to distinguish between files and dir, a mimetype
check would be good,

the FTP protocol doesn't specify the format for the output from the LIST
command, so you have to use some heuristics; see e.g. the code in

http://svn.python.org/projects/pytho...s/ftpmirror.py

or use a wrapper for Dan Bernstein's ftpparse library (requires a C
compiler):

http://cr.yp.to/ftpparse.html
http://c0re.23.nu/c0de/ftpparsemodule/
http://effbot.org/downloads/#ftpparse
ftpparse seems broken, I found ftputil as the best solution,

thanks
Nicola
Not sure what you mean by "mimetype"; that has nothing to do with
directories vs. files, afaik.

</F>

--
http://mail.python.org/mailman/listinfo/python-list
Aug 21 '08 #1
0 557

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by BPearson | last post: by
3 posts views Thread by Silvester | last post: by
5 posts views Thread by Eugene Anthony | last post: by
6 posts views Thread by Emmanuel Petit | last post: by
reply views Thread by Mailing List SVR | last post: by
reply views Thread by Fredrik Lundh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.