#!/bin/sh
cd "$(dirname "$0")"

# read URL from meta.txt
url=$(grep '^URL:' ../meta.txt | cut -d' ' -f2)
file="${url##*/}"

# read userAgent from property file
. ./userAgent.property.sh

curl --silent --show-error --user-agent "$userAgent" "$url" > "$file"

cp *.xml ..

#!/bin/sh
cd "$(dirname "$0")"

# read URL from meta.txt
url=$(grep '^URL:' ../meta.txt | cut -d' ' -f2)
file="${url##*/}"

# read userAgent from property file
. ./userAgent.property.sh

curl \
  --silent --show-error \
  --user-agent "$userAgent" \
  --time-cond "$file" \
  --remote-time \
  --output "$file" \
  "$url"

cp *.xml ..

Configure curl to only download files if not modified
Configure curl to only download files if not modified

I configured curl to save the downloaded file by name,
and set its time to the last modified date of the file,
and only download the file anew if modified more recently
than the file which may already be present.
