FtpUtils Progress Bar

Timothy Smith timothy at open-networks.net
Wed Sep 13 22:53:15 EDT 2006


iwcook58 at 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)+'%')



More information about the Python-list mailing list