471,354 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Download several files at once using FTP

1
I am new to python and I am using the FTP module to retrieve files via FTP. This is a sample of my code:

buffer = StringIO.StringIO()
ftp.retrbinary('RETR CAT3.TXT', buffer.write)
ftp.retrbinary('RETR CAT4.TXT', buffer.write)

When I view the buffer the only information I see is the last file info which is CAT4.TXT. Is there a way I can create a list of these files?

Thanks.
Jul 20 '07 #1
2 2482
bartonc
6,596 Expert 4TB
Found this in the Articles section.
Jul 20 '07 #2
bartonc
6,596 Expert 4TB
I am new to python and I am using the FTP module to retrieve files via FTP. This is a sample of my code:

buffer = StringIO.StringIO()
ftp.retrbinary('RETR CAT3.TXT', buffer.write)
ftp.retrbinary('RETR CAT4.TXT', buffer.write)

When I view the buffer the only information I see is the last file info which is CAT4.TXT. Is there a way I can create a list of these files?

Thanks.
Expand|Select|Wrap|Line Numbers
  1. >>> import StringIO
  2. >>> for i in range(3):
  3. ...     exec("buffer%d = StringIO.StringIO()" %i)
  4. ...     
  5. >>> buffer0
  6. <StringIO.StringIO instance at 0x02FDC8A0>
  7. >>> buffer1
  8. <StringIO.StringIO instance at 0x02FDCEB8>
  9. >>> buffer2
  10. <StringIO.StringIO instance at 0x03038B98>
  11. >>>
Jul 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Paul | last post: by
1 post views Thread by RJN | last post: by
1 post views Thread by rdemyan via AccessMonster.com | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.