samedi 27 décembre 2014

Pipe file downloaded with wget into a function


I'm downloading a bunch of images with wget and I want to rm the files if they are empty



wget -q -O- http://ift.tt/1wPQX6r | sed -n '{/forum-post-body-content/,/p-comment-notes/p}' | grep -Po 'src="\K[^"]+' | xargs wget


I want to do a function in a separate script to which I can be passing the images as I download them and check in that function if the files are empty.



if ![ -s $file ]
then
rm $file;
fi


Aucun commentaire:

Enregistrer un commentaire