Skip to content

Instantly share code, notes, and snippets.

@mnewt
Created June 16, 2017 14:52
Show Gist options
  • Save mnewt/ae302ec91055529a154eefbcc37769eb to your computer and use it in GitHub Desktop.
Save mnewt/ae302ec91055529a154eefbcc37769eb to your computer and use it in GitHub Desktop.
Download a file iff URL's HTTP If-Modified-Since header is more recent than the local file timestamp
#!/usr/bin/env bash
# Download a file iff URL's HTTP If-Modified-Since header is more recent than
# the local file timestamp
url="$1"
file="$2"
shift 2
curl -z "$file" -Lo "$file" "$url" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment