473,395 Members | 1,343 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,395 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 2578
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

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

Similar topics

3
by: Paul | last post by:
I need a way of creating a custom file which can be downloaded by a user. The file needs to be customized pre user (ie serial number built in). Creating the file is no problem. The problem is how...
1
by: RJN | last post by:
Hi Sorry for posting this again. Requirement is to allow the user to download multiple files at once from browser. User will be displayed a grid on the browser which will list the various files...
1
by: rdemyan via AccessMonster.com | last post by:
My App has 10 or so tables that we provide that contains proprietary data. This data will need to be updated once or twice a year. I would like some comments, suggestions on my proposed strategy...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.