If I have a list of URLs separated by \n, are there any options I can pass to wget to download all the URLs and save them to the current directory, but only if the files don't already exist?


There is a -nc (--no-clobber) option for wget.

  • 2
    I read this after writing my Bash script to check for the existence of files individually! – anotherdave Jul 5 '19 at 8:30

From wget --help:

-i,  --input-file=FILE     download URLs found in local or external FILE.
-nc, --no-clobber          skip downloads that would download to
                           existing files.
-c,  --continue            resume getting a partially-downloaded file.

I've included --continue because it seemed like it might be helpful if you're trying to recover from an interrupted download, but you don't need it to answer your original question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.