0

When I download jpegs from an unreliable website, the downloads are often incomplete. Is there a wget option to delete incomplete downloads?

1 Answer 1

1

You can check the exit status of wget

set "output=x:\somewhere\myFile.dat" wget -O "%output%" "http://somewhere.com/this" if errorlevel 1 del "%output%" 2>nul 

Or using conditional execution operator || (execute next command if the previous fails)

set "output=x:\somewhere\myFile.dat" wget -O "%output%" "http://somewhere.com/this" || ( 2>nul del "%output%" ) 

note: Of course, you don't need the variable, just included to avoid having to write the same file name in both commands.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.