Powershell download entire directory contents

12,423

Unless PowerShell is a requirement, using wget would be an easier way to mirror something like that:

wget --mirror --no-parent --accept=tif http://gisdata.nd.gov/NAIP/2012/zGeoTiffs/
Share:
12,423
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    http://gisdata.nd.gov/NAIP/2012/zGeoTiffs/

    I would like to download the entire directory, each link contains another series of links.

    This is what I have so far and it works sort of (brings back a 200 status), but it doesn't download

    import-module bitstransfer
    invoke-webrequest “http://gisdata.nd.gov/NAIP/2012/zGeoTiffs/”
    select -exp links|where{$_.href -like "*.tif"}
    select -exp href|foreach{start-bitstransfer $_ F:\GIS\2012GeoTiff}