When maintaining local copies of remote directories, you may want to skip files that haven’t changed. wget can compare timestamps, downloading only files that are newer or missing locally.

By using options like --timestamping, wget retrieves resources only if they differ from your local copy. This saves time and bandwidth, making updates efficient and automatic.

This incremental approach is ideal for regularly updated content, daily backups, or synchronizing resources without redownloading everything.

Steps to download only newer files using wget:

  1. Use --timestamping or --time-stamps to enable conditional downloading.
    $ wget --timestamping http://www.example.com/files/

    wget checks remote timestamps and skips downloads if files are up-to-date locally.

  2. Run the same command again later to update only changed files.
  3. Combine with recursive options to maintain mirrored directories efficiently.
  4. Monitor logs to see which files were actually downloaded.
  5. Adjust local organization to align with the server’s structure for best results.
Discuss the article:

Comment anonymously. Login not required.