$wc = New-Object system.net.webclient $data = $wc.DownloadData("http://ocw.nctu.edu.tw/riki_detail.php?pgid=235&cgid=3") $utf8 = [system.text.encoding]::getencoding("utf-8") $page = $utf8.GetString($data) $REGEX = [regex] "<a href=`"\.\.\/\.\.(?<URL>\/.*\/(?<NM>.*\.pdf))`" target=`"_blank`">" $mes = $REGEX.Matches($page) $dirinfo = new-object system.io.directoryinfo "c:\os" if(!$dirinfo.exists){$dirinfo.create()} $MES | %{ $wc.DownloadFile("http://ocw.nctu.edu.tw" + $_.Groups["URL"], "C:\os\" + $_.Groups["NM"]) } |
math | Mathematics > math | Downloads >