home

Quickies, by Andrea Olivato

text

Recursively download a #Ftp tree via #Wget

This shows how to download recursively a complete ftp tree using wget command line tool

wget -r 'ftp://USER:PASS@HOST/PATH'

3 years ago

December 30, 2009
Comments (View)
text

Create a Zenity progress bar using wget output

I found this simple script to redirect wget progress bar to a nicer zenity window.

Sed is used to parse the output and send to Zenity only the correct progress. An infinite bash cycle is used to check that zenity is still running (if the user closes the window probably you want wget to be killed)

# Start wget | zenity
# Note the & at the end of the pipe, this allows the script to continue with wget running in the background
wget http://filename 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --progress --title="Downloading File..." &

#Start a loop testing if zenity is running, and if not kill wget
RUNNING=0
while [ $RUNNING -eq 0 ]
do
if [ -z "$(pidof zenity)" ]
then
  pkill wget
  RUNNING=1
fi
done

3 years ago

July 9, 2009
Comments (View)