Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple zip file downloads from URL

    I am trying to download and unzip multiple files from a URL to then use in STATA.

    I have requested data from the Institute of Health Metrics and Evaluation, for which they have provided a link to 331 zip files here:

    http://ghdx.healthdata.org/gbd-resul...90fcefba756ce1

    I copied the link for the first file which is this:

    http://s3.healthdata.org/gbd-api-201...12208c13-1.zip

    all the other files are then the same with the end being -1 to -331.

    I was planning to use "copy" and then "unzipfile" and run a loop from 1 to 331. However I am getting the error message "invalid file specification" when try this for the first file following:

    copy http://s3.healthdata.org/gbd-api-201...12208c13-1.zip

    Does anyone know why this is the case?

    Best Wishes

    Joe

  • #2

    Maybe this comment seems a bit too obvious, but:
    The syntax for copy is "copy filename1 filename2"; the first filename tells Stata which file to copy (the source file), and the second where to store your copy (the target file). Did you enter a target file name? I suggest:
    Code:
    copy "http://s3.healthdata.org/gbd-api-2017-public/12208c13e5f8cb240d90fcefba756ce1_files/IHME-GBD_2017_DATA-12208c13-1.zip" "IHME-GBD_2017_DATA-12208c13-1.zip"
    When I run this code, Stata tells me the server responded "file permanently redirected to https://s3.healthdata.org/gbd-api-2017-public/12208c13e5f8cb240d90fcefba756ce1_files/ihme-gbd_2017_data-12208c13-1.zip". Thus, your URL should probably start with "https" instead of "http"; when I change the URL accordingly, this works fine on my machine.

    Regards
    Bela
    Last edited by Daniel Bela; 15 Jan 2019, 06:36.

    Comment

    Working...
    X