linux - How to get wget only save file if its complete -


i downloading files using wget this

wget http://www.example.com/mysql.zip -o mysql.zip 

then have stuff file.

but if there error in url or somewhere corrupted file mysql.zip

is placed in there , script don't download file there , script fails.

is there way if mysql.zip placed if file download complete.

there 2 cases when can happen

  1. url not exist
  2. user manually cancels download

in both above cases don't want file there

what bash script:

#!/bin/bash if wget http://www.example.com/mysql.zip -o mysql.zip     # file else     rm mysql.zip fi 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -