Download series of images with Powershell

I am trying to understand this, I know the name of the first image and the last image. There must be a way to automaticly download the once between. How is the easiest way to do this?


I have tried curl, but it does only download one image and its corrupted.

curl[0001-0406].jpeg -o “C:location\pic#1.jpeg”

I sort of solved it. I did create a list with numbering files and then use that file with this script, but its more complicated as it should be, could this be modifyd so the [link_to]/image_3_0001.jpeg to [link_to]/image_3_0406.jpeg could easier be added in the same script?

$folder = “[folder location]”
$userAgent = “Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1”
$web = New-Object System.Net.WebClient
$web.Headers.Add(“user-agent”, $userAgent)

Get-Content “thingstodownload.txt” |
Foreach-Object {
"Downloading " + $_
try {
$target = join-path folder ([io.path]::getfilename())
, target) } catch { _.Exception.Message