1

I'm browsing a site whose author includes multiple links to files on Dropbox. I want to download all of them without clicking each individual link. I have several Chrome extensions that batch download files, but they download the html "preview" rather than the files themselves.

Is there any solution that will allow me to download all links from a page?

Downloading all files on the account will also work.

1 Answer 1

0

Here are two code samples in the latest Windows Powershell.

Multiple individual files of one type

For ($i=1; $i -le 15; $i++) {
    "{0:D2}" -f $i
    wget -Uri https://www.dropbox.com/s/6bi1fec2toq7e69/Chapter$i.pdf?dl=1 -OutFile "Chapter$i.pdf" -Verbose
}

Entire folders as zip files

$html = New-Object -ComObject "HTMLFile"
 
$html.IHTMLDocument2_write($(Get-Content .\Ansys.html -raw))

$links=$html.Links
 
#$html.all.tags("A") | % innerText

$urls = $links | Where-Object {$_.href -like “http*”} 

Foreach ($i in $urls) {

    if ($i.outerHTML -like "*.zip*") {
        $source  = $i.outerHTML.ToString()|%{$_.split('"')[1]}|%{$_.substring(0,$file.length-1) + '1'}
        $outfile = $file.split('/')[5]|%{$_.split('?')[0]}
        wget -Uri $source -OutFile $outfile
    }
} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .