[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Bugs/New features
From: |
Dale R. Worley |
Subject: |
Re: [Bug-wget] Bugs/New features |
Date: |
Sun, 28 May 2017 19:25:42 -0400 |
Glacial Man <address@hidden> writes:
> 1) The name of the downloaded file is "windows." (or "stable."),
> probably because are not available static links but server requests
> only. How can I indicate to wget (used with --timestamping option)
> that the local file name's must be "uTorrent.exe"? (as if I download
> it using a browser)
> Pratically, how can I indicate to wget (used with --timestamping
> option) the path of the local file?
You could probably use --output-document=name. However, since wget
conceptually can download many files in a session, and --output-document
is defined to put all downloaded files into one file, there might be
unpleasant interactions with --timestamping or --no-if-modified-since.
> when I use the --timestamping option, I need to manage the
> different cases to know what's occurred and, for example, to write
> in a log file
wget won't do that, but you could do something like:
# May return error if uTorrent.exe doesn't exist.
cp uTorrent.exe uTorrent.exe.save
wget ...
if ! cmp uTorrent.exe uTorrent.exe.save
then
... do whatever you do if it has changed
fi
rm uTorrent.exe.save
Or you could save the hash of it in a shell variable and compare that:
OLD_HASH=$( sha1sum uTorrent.exe )
wget ...
NEW_HASH=$( sha1sum uTorrent.exe )
if [ $OLD_HASH != $NEW_HASH ]
then
...
> 3) The same for the --spider option, I need to know if the file is:
> - downloadable (local file not available)
> - updatable (different timestamp)
> - already up to date (same timestamp)
It looks like wget --spider only tells you if the file exists on the
server.
Dale