newbie needs a little help... trying to write an ftp script.

Duane Kaufman duanek at chorus.net
Tue Jul 29 09:49:54 EDT 2003


Hi,

I have had a similar need recently, and have found a module called
ftputil:
http://www.ndh.net/home/sschwarzer/python/python_software.html

This enables one to deal with FTP hosts on a file basis, and makes
things _much_ easier.

Good luck,
Duane

Wojtek Walczak <gminick at hacker.pl> wrote in message news:<bg58tn$4jc$1 at atlantis.news.tpi.pl>...
> Dnia 28 Jul 2003 11:40:48 -0700, google account napisa³(a):
> [...]
> > The docs suggest that I could do something like....
> > 
> > import ftplib
> > 	
> > ftp = ftplib.FTP('172.30.30.30')  # This is wrong,  somehow...?
> > ftp.login(user,pass)
>                  ^^^^
> Do not use pass in this way - it's a python's keyword. Use some other 
> name instead.
> 
> > ftp.retrlines('LIST')  # I believe it might need to be
> > ftp.retrlines('ls -al')
> > ftp.sendcmd('prompt')
> > ftp.cwd('folder')
> > ftp.retrbinary(retr *tgz)
> > ftp.quit()
> Here's a simple example:
> 
> import ftplib,sys
> 
> ftp = ftplib.FTP('ftp.python.org')
> ftp.login('anonymous','qwe at asd.pl')
> print ftp.retrlines('LIST')
> ftp.cwd('pub/python')
> print ftp.retrlines('LIST')
> print ftp.retrbinary('retr README', sys.stdout.write)
> ftp.quit()




More information about the Python-list mailing list