Created
January 4, 2016 02:49
-
-
Save mikecasas/43fa1057554e1e6aeca9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
$folder='http://site/wp-content/uploads' | |
$webClient = New-Object System.Net.WebClient | |
$destinationFolder='C:\p2014' | |
#Get the file list from the web page | |
$webString = $webClient.DownloadString($folder) | |
$lines = [Regex]::Split($webString, "<li>") | |
#Parse each line, looking for files and folders | |
foreach ($line in $lines) { | |
if ($line.ToUpper().Contains(".MP3")) { | |
$items =[Regex]::Split($line, """") | |
$item = $items[1] | |
#Write-Output $item | |
if($item.StartsWith("14")) { | |
$url=($folder + '/' + $item); | |
$destination=($destinationFolder + '\' + $item); | |
Write-Output $url | |
$webClient.DownloadFile($url, $destination) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment