locked
Download multiple files from the artifactory repo using powershell RRS feed

  • Question

  • I was trying to write a powershell script which downloads multiple files from my artifactory repo. I could use some kind of logic as below by passing file names.

    $files = @("test1.zip", "test.zip") 
    
    foreach($file in $files)
    {
    Invoke-WebRequest -Uri "$artifactory_url/$file" -OutFile "D:\download\$file"
    }

    But, Is there any way to download all the files with out passing names? I tried with wildcards like (*zip) but, looks like Invoke-webrequest isn't accepting the wildcards. And found no luck with Start-bittransfer cmdlet.

    I was able to pull up list of files in the repo using below command

    ((Invoke-WebRequest $url).links | Where href -match "zip$").href

    How can I use this command to download the files? Is there any better way to download multiple files from the artifactory repo or http endpoint?

    Thanks in advance


    Tuesday, September 5, 2017 5:38 PM

All replies

  • You have to parse the list and extract the file names and pass them to the web call.


    \_(ツ)_/

    Tuesday, September 5, 2017 5:54 PM