Skip to main content

Download a file only if the remote file has changed.

Project description

Download Latest

Download a file only if the remote file has changed.

Example

URL='https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US'
ARCHIVE="firefox.tar.bz2"

dl "$URL" "$ARCHIVE"

if [ -f "$ARCHIVE.new" ]; then
  echo "New version detected"
  tar -xjf "$ARCHIVE"
fi

Install

pip install download-latest

Make sure cURL and Python 3 are installed. See the install guide for more information.

Usage

usage: download-latest [ -h | --help ] [OPTIONS] URL [FILE]

Download URL to FILE only if remote file has changed.

positional arguments:
  URL            url to download
  FILE           path to output (deduced if not specified, see below)

options:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit
  -n, --dry-run  do not download (default: false)
  -f, --force    do not check for changes (default: false)
  -q, --quiet    suppress output (default: false)
  -v, --verbose  increase output (default: false)
  --color        enable colorized output
  --no-color     disable colorized output
  --progress     enable the progress meter
  --no-progress  disable the progress meter

If the color or progress options are not specified, they are determined
from the TTY.

If FILE is not specified, it will be deduced by the filename part of the
URL. If no filename can be deduce, e.g., https://example.com/, then the
program will exit with an error.

Additional files may be generated:

FILE.new       present when download occured, otherwise absent
FILE.download  in-progress download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

download_latest-0.0.3.tar.gz (28.0 kB view hashes)

Uploaded Source

Built Distribution

download_latest-0.0.3-py3-none-any.whl (30.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page