I can download a single file from the web using:
$wc = New-Object System.Net.WebClient
$wc.DownloadFile("http://blah/root/somefile.ext", "C:\Downloads\www\blah\root\somefile.ext")
But how do I download all the files, including subfolders? Something like the following would be nice…
$wc.DownloadFile("http://blah/root/", "C:\Downloads\www\blah\root\")
The root folder itself appears as a directory listing in IE, you know, like:
[To Parent Directory]
01 July 2012 09:00 1234 somefile.ext
01 July 2012 09:01 1234 someotherfile.ext
As a bonus, how would I just downloading the files in the root folder, ignoring subfolders?
Here’s what I came up with based on Andy’s suggestion (with plenty of help from Google, of course):
No guarantees of course, but it worked for the site I was interested in