1

I'm struggling to find how I would be able to download a file that's accessible via a URL, but don't keep downloading it if the file on the URL is newer than the file in existence.

Using Power shell this command downloads the file, but it will just download it again regardless if it's there already.

Invoke-WebRequest http://www.domain.co.uk/downloads/File.zip -OutFile C:\Temp\File.zip

I know the command line for copying local files with "XCOPY /D" to check for the date/time stamp but I am wondering if something similar can be done downloading a file from the internet?

Many thanks in Advance

Adam Lacey
  • 103
  • 1
  • 11
  • 2
    Possible duplicate of [How can I download a file only if it has changed using powershell](https://stackoverflow.com/questions/26533819/how-can-i-download-a-file-only-if-it-has-changed-using-powershell) – Compo Apr 24 '18 at 10:58
  • I was going to mention that one but that one asn't working for me. It may be i'm not understanding it correctly but using the script thats marked as the "Answer" I didn't understand where to put the URL/URI or the local output path – Adam Lacey Apr 25 '18 at 16:02
  • It appears to be a function which takes two parameters, the first is the URL and the second is the file location – Compo Apr 25 '18 at 16:17
  • I try running it from CMD as: powershell.exe -File "C:\temp\DownloadScript.ps1" http:// w w w.DOMAIN.co.uk/downloads/FILE.zip C:\Temp\FILE.zip and I don't get anything what so ever :( – Adam Lacey May 22 '18 at 13:05

0 Answers0