Python Wget: Check for duplicate files and skip if it exists?
wget.download()
doesn't have any such option. The following workaround should do the trick for you:
import subprocess
url = "https://url/to/index.html"
path = "/path/to/save/your/files"
subprocess.run(["wget", "-r", "-nc", "-P", path, url])
If the file is already there, you will get the following message:
File ‘index.html’ already there; not retrieving.
EDIT:
If you are running this on Windows, you'd also have to include shell=True
:
subprocess.run(["wget", "-r", "-nc", "-P", path, url], shell=True)