summaryrefslogtreecommitdiff
path: root/download-pubmed
blob: 4bf60cfa0a19e03cfe0e26294a57c203ed315d2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh

download() {
  dir="$1"
  nquire -lst ftp.ncbi.nlm.nih.gov "pubmed" "$dir" |
  grep -v ".md5" | grep "xml.gz" |
  skip-if-file-exists |
  while read fl
  do
    echo "$fl"
    echo "$fl" |
    nquire -asp ftp.ncbi.nlm.nih.gov "pubmed" "$dir"
  done
}

if [ "$#" -eq 0 ]
then
  download "baseline"
  if [ $? -ne 0 ]
  then
    download "baseline"
  fi
  download "updatefiles"
  if [ $? -ne 0 ]
  then
    download "updatefiles"
  fi
fi

while [ "$#" -gt 0 ]
do
  sect="$1"
  shift
  download "$sect"
  if [ $? -ne 0 ]
  then
    download "$sect"
  fi
done