473,327 Members | 2,118 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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 611

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tim | last post by:
I am in the process of moving a site from one hosting company to another. This site is fairly large, with hundreds of asp files, each with multiple "include" statements. The new host has a...
5
by: Jon Maz | last post by:
Hi there, I am experimenting with the FileSystemWatcher object. I have set the NotifyFilter as follows: myFileSystemWatcher.NotifyFilter = NotifyFilters.Security | NotifyFilters.CreationTime...
5
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to...
3
by: Silvester | last post by:
I need to trigger some code when user drags and drops an entire folder onto my form. How can I distinguish between a folder drop and files dropped ? Can someone point me to code or a sample,...
5
by: Eugene Anthony | last post by:
ds1.Tables.Rows.ItemArray.GetValue(0).ToString() contains the string path: images/5/Video1/qbert.flv if (File.Exists(ds1.Tables.Rows.ItemArray.GetValue(0).ToString())) { //code to execute } ...
6
by: Emmanuel Petit | last post by:
First of all I am rather new into PHP. I use php 5 and I am putting together a web site for a local association I belong too. Most of the site is okay, except for this problem : I need to be...
2
by: DDD | last post by:
I have a web site project using C#. If I release the web site in the VS2005, all works well except that DLL file name has some strange, name APP_Code_erwer234.dll. And erwer234 is a random string....
0
by: Mailing List SVR | last post by:
Hi, is there a simple way to do this? ftplib seems unable to distinguish between files and dir, a mimetype check would be good, regards Nicola
0
by: Fredrik Lundh | last post by:
Mailing List SVR wrote: 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 ...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.