FTP program works -- now how do I send the directory over?
piet at cs.uu.nl
piet at cs.uu.nl
Thu Jul 5 07:33:57 EDT 2001
>>>>> Kemp Randy-W18971 <Randy.L.Kemp at motorola.com> (KR) writes:
KR> The following FTP program now works, in connecting on my windows machine to my Unix server. What statements need I add to ftp the directory files in d:\programsPerl to /usr2/ecadtesting/tarbackups/?
KR> import string, os
KR> import ftplib
KR> from ftplib import FTP
KR> print string.join(os.listdir('d:\programsPerl'),',')
KR> ftp = FTP('144.144.144.144') #specify host
KR> ftp.connect # defaults to port 21, check docs for further options
KR> ftp.login(user='elmer',passwd='fudd',acct='donald') # user info
KR> ftp.cwd('/usr2/ecadtesting/tarbackups/')
KR> ftp.retrlines('LIST') # list directory contents
KR> ftp.quit()
Well you got your answer already in a different thread. *HINT: don't
switch threads.*
The ftp.connect above can be removed. As others have remarked it's called
by default, but yours above doesn't even call it. The () are missing.
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl
More information about the Python-list
mailing list