473,396 Members | 2,076 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,396 software developers and data experts.

FtpUtils Progress Bar

Hi,
I can successfully upload and download files using Stefan's Schwarzer's
ftputil script.

The problem is that as some of the files are quite large you cannot see
how much has been downloaded/uploaded.
Even a percentage or just dots going across the screen would be better
than nothing.

Does anyone have an example on how to show the progress of the
upload/download when using ftputil?

Thanks in advance.

Kind regards
Ian Cook

Sep 14 '06 #1
3 3856
iw******@gmail.com wrote:
Hi,
I can successfully upload and download files using Stefan's Schwarzer's
ftputil script.

The problem is that as some of the files are quite large you cannot see
how much has been downloaded/uploaded.
Even a percentage or just dots going across the screen would be better
than nothing.

Does anyone have an example on how to show the progress of the
upload/download when using ftputil?

Thanks in advance.

Kind regards
Ian Cook

try this

def _reporthook(numblocks, blocksize, filesize, url=None):
base = os.path.basename(url)
try:
percent =
min((numblocks*blocksize*100)/filesize, 100)
except:
percent = 100
if numblocks != 0:
print str(percent)+'%')
Sep 14 '06 #2
iw******@gmail.com wrote:
Hi,
I can successfully upload and download files using Stefan's Schwarzer's
ftputil script.

The problem is that as some of the files are quite large you cannot see
how much has been downloaded/uploaded.
Even a percentage or just dots going across the screen would be better
than nothing.

Does anyone have an example on how to show the progress of the
upload/download when using ftputil?
You'll probably have more luck asking at
http://codespeak.net/mailman/listinfo/ftputil.

George

Sep 14 '06 #3
iw******@gmail.com wrote:
>
Does anyone have an example on how to show the progress of the
upload/download when using ftputil?
haven't used ftputil in quite a while ...
but using ftplib...

import ftplib

class Callback(object):
def __init__(self, totalsize, fp):
self.totalsize = totalsize
self.fp = fp
self.received = 0

def __call__(self, data):
self.fp.write(data)
self.received += len(data)
print '\r%.3f%%' % (100.0*self.received/self.totalsize),

if __name__ == '__main__':
host = 'ftp.microsoft.com'
src = '/deskapps/games/public/Hellbender/heltrial.exe'
c = ftplib.FTP(host)
c.login()
size = c.size(src)
dest = 'heltrial.exe'
f = open(dest, 'wb')
w = Callback(size, f)
c.set_pasv(0)
c.retrbinary('RETR %s' % src, w, 32768)
f.close()
c.quit()

Sep 14 '06 #4

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

Similar topics

7
by: Pepi Tonas | last post by:
I have a form that takes some time to load because it has to populate some Data. I was trying to display a form on top of it with an activity bar so that user can see that something's going on. ...
1
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET...
15
by: eladla | last post by:
Hi! I am creating a composite control the does some of it`s own data access. I want to display a progress bar between the time the page is loaded and the control place holder is displayed and...
0
by: jags_32 | last post by:
Hello We use MFG-PRO as our ERP system which in turn uses Progress databases. In the old version of SQL 2000, using DTS packages, we used to set the code page via command prompts and execute DTS...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.