Hey all,
I have written a small script to download certain files from an ftp site. I use the wget function.I'd like to get a progress-bar with zenity to show the advancement of the wget function. Can anyone suggest a solution?
Thanx,
Shreerang Patwardhan.

Hey all,
I have written a small script to download certain files from an ftp site. I use the wget function.I'd like to get a progress-bar with zenity to show the advancement of the wget function. Can anyone suggest a solution?
Thanx,
Shreerang Patwardhan.

I had to look into this since I've never used zenity, and it sounded interesting.

Very easy stuff actually. Zenity parses a lot of it's input and in the case of the --progress option apparently just looks for a percentage, so the quick and dirty thing to do is simply redirect wgets screen output including progress bar to zenity --progress. Then add some nice zenity features like auto kill and auto close.

wget --progress=bar:force "http://base.url.here/filename.txt" -O/your/destination/and/filename 2>&1 | zenity --title="File transfer in progress!" --progress --auto-close --auto-kill

The redirect of screen output is what I assume was giving you trouble, which is what the 2>&1 is all about.

As an example, I did this to try it out:

wget --progress=bar:force --limit-rate=250 "http://www.google.com/intl/en_ALL/images/logo.gif" -O/dev/null 2>&1 | zenity --title="file transfer in progress" --progress --auto-close --auto-kill

I hope google doesn't mind us pulling down their logo at 250B/s for testing our script.

REF:
man wget
man zenity

Comments
Thanks. This will come in very handy.

I'm confused, wget already displays progress...

This wget/zenity combo is ideal for setting up a visual indicator of an occurring download without having to open a terminal. For example, link the script to Flashgot in Firefox and you can download Firefox linked files using wget and get a really nice GUI progress bar, rather than a terminal version that'll just get in your way. Also handy for ruTorrent for example, where ruTorrent is running on a VPS and you need an easy way to get the completed torrents onto your home box. Should work just as well with Rsync.

Besides, Zenity is cool and it just looks nicer that way. :cool:

I'm going to use it. I'm glad I found this thread.

This article has been dead for over six months. Start a new discussion instead.