PowerShell – Download Specific Type of Files

email me

Download all the files from a website that are a specific type:

$Site = 'http://eddiejackson.net/apps'
$Links = (Invoke-WebRequest –Uri $Site).Links | ? href -like *zip*
$Links | select -Unique href | % {
$File = $_.href
$URL = "http://eddiejackson.net/apps/$File"
Invoke-WebRequest -Uri $URL -OutFile "c:\zip\$File" -Verbose
}

 

Notes

Invoke-WebRequest

 

Download two types of files:

$Site = 'https://eddiejackson.net/apps'

$Type1 = (Invoke-WebRequest –Uri $Site).Links | ? href -like *zip*
$Type2 = (Invoke-WebRequest –Uri $Site).Links | ? href -like *exe*
$List = $Type1 + $Type2

Clear-Host

$List | select -Unique href | % {

$File = $_.href
$URL = "http://eddiejackson.net/apps/$File"

#Write-Host $File
Invoke-WebRequest -Uri $URL -OutFile "c:\downloads\$File" -Verbose

}

 

tags: Download files from web, file types, MrNetTek