How to download only newer files with wget

Timestamp-aware downloads are useful for recurring update jobs where unchanged files should be skipped instead of fetched again. That keeps scheduled pulls lighter on bandwidth, shortens repeated syncs, and avoids rewriting the same local copy on every run.

GNU wget uses --timestamping (-N) to compare the local file with the remote file metadata. If the local file is missing, or if the server reports a newer copy or a different size, wget downloads the file again. On HTTP, an unchanged rerun commonly ends with 304 Not Modified and no new file data is written.

Timestamping only works when the server exposes usable modification times, such as an HTTP Last-Modified header or parseable FTP dates. Re-run the command in the same directory and keep the server-derived filename, because current GNU wget warns that timestamping does nothing in combination with --output-document.

Steps to download only newer files with wget:

  1. Download the file with --timestamping so the first run also stores the remote modification time locally.
    $ wget --timestamping https://example.net/archive.tar.gz
    --2026-04-22 10:44:00--  https://example.net/archive.tar.gz
    HTTP request sent, awaiting response... 200 OK
    Length: 2097152 (2.0M) [application/gzip]
    Saving to: 'archive.tar.gz'
    
    ##### snipped #####
    
    2026-04-22 10:44:00 (12.4 MB/s) - 'archive.tar.gz' saved [2097152/2097152]

    Run later checks from the same directory so wget compares against this local file instead of creating a second copy elsewhere.

  2. Run the same command again and confirm that unchanged content is skipped.
    $ wget --timestamping https://example.net/archive.tar.gz
    --2026-04-22 10:44:08--  https://example.net/archive.tar.gz
    HTTP request sent, awaiting response... 304 Not Modified
    File 'archive.tar.gz' not modified on server. Omitting download.

    A 304 Not Modified response is the usual HTTP proof that the saved local file is already current.

  3. Repeat the same command after the remote file changes and confirm that wget downloads the newer copy.
    $ wget --timestamping https://example.net/archive.tar.gz
    --2026-04-22 10:44:21--  https://example.net/archive.tar.gz
    HTTP request sent, awaiting response... 200 OK
    Length: 3145728 (3.0M) [application/gzip]
    Saving to: 'archive.tar.gz'
    
    ##### snipped #####
    
    2026-04-22 10:44:21 (18.7 MB/s) - 'archive.tar.gz' saved [3145728/3145728]

    The URL and command stay the same. The newer server timestamp is what causes the fresh download.

  4. Run the timestamped command once more to confirm that the updated local copy is now current again.
    $ wget --timestamping https://example.net/archive.tar.gz
    --2026-04-22 10:44:29--  https://example.net/archive.tar.gz
    HTTP request sent, awaiting response... 304 Not Modified
    File 'archive.tar.gz' not modified on server. Omitting download.

    Do not combine --timestamping with --output-document for repeated checks. GNU wget warns that the fixed output file breaks the timestamp comparison and forces a new download.