Συλχαν
Συλχαν

Reputation: 45

How to make wget *not* overwrite/ignore files?

I have a list of 400 websites from where I'm downloading PDF's. 100 of these websites share the same pdf name: templates.pdf
When running wget, it either ignores the pdfs that have name "templates" or overwrites them. I was searching for a command that would make a new templates2.pdf for 2 hours, but I couldn't find anything.

Upvotes: 0

Views: 1667

Answers (1)

Ray Toal
Ray Toal

Reputation: 88378

The default behavior of wget is to use the .1, .2 prefixes when a file is downloaded multiple times into the same target directory. This appears to be what you are asking for. (The poorly named -nc option causes subsequent downloads of files with the same name to be ignored, which you don't want).

If the default behavior is not what you want, the -O option looks promising, as it allows you to _choose) the output file name. Here is a brief article explaining its use.

Of course, if you go the -O route, you'd need to ensure the output file does not exist, and do the suffix incrementing on your own.

Upvotes: 1

Related Questions