DownloadFile
Package: WA2L/SimpleBackup 1.0.67
Section: General Commands (1)
Updated: 23 February 2021
Index
Return to Main Contents
NAME
DownloadFile - download file(s) from http(s) URL
SYNOPSIS
DownloadFile
[
-h
|
-V
]
DownloadFile
-s URL
-d filename
[
-r
retries[,interval]
][
-b
]
DownloadFile
-s URL
-d filename
[
-r
retries[,interval]
]
-l
[
-t timeout
|
minimum-maximum
][
-z timezone
][
-n
][
-i
]
AVAILABILITY
WA2L/SimpleBackup
DESCRIPTION
DownloadFile
is a command line utility to download a file addressed in
a web URL to local file(s).
One time file download
DownloadFile
-s URL
-d filename
[
-r
retries[,interval]
][
-b
]
This is used to download the specified file once and terminate.
Repetitive file download
DownloadFile
-s URL
-d filename
[
-r
retries[,interval]
]
-l
[
-t timeout
|
minimum-maximum
][
-z timezone
][
-n
][
-i
]
When using the
-l
option (=loop download) the file addressed in the web URL
is downloaded repetitively and saved to a local file with a
time stamp added to the file name.
The downloaded file is only kept if it is different to the
previously downloaded file.
This mode can be used for instance to download a webcam
image and keep all files to create a time lapse view of
the downloaded image files.
The time stamp that is added to the file name has the format
YYYYMMDDhhmmss.
It might make sense that the time stamp is equal to the time
where the web cam is located. To do so, set the time zone of
the origin using the
-z
option or set the
TZ=timezone
environment variable.
The command shows a
wait
output indicating a countdown to the next download attempt.
When pressing
any key
during this output the waiting is aborted and an immediate
download attempt is performed.
OPTIONS
- -h
-
usage message.
- -V
-
print program version.
- -s URL
-
source URL.
If
-
is specified as file name, the
URL
is read from
stdin
(standard input).
- -d filename
-
destination file name.
- -b
-
add a 'cachebreaker'
(e.g.:
http://acme.ch/webcam.jpg?1534528554)
to the
URL
to force a fresh download of the file from the server
independent of caching proxies in between.
- -r retries
-
number of
retries
on failed file download.
- -r retries,interval
-
number of
retries
on failed file download and
interval
between retries in seconds.
The default number of retires is
0
and the minimum retry interval is
4
seconds.
- -l
-
indefinitely repeat the download (=loop download)
and save the downloaded file with a time stamp added to
the file name.
The downloading can be stopped pressing the
Ctrl+C
keys.
- -t timeout
-
fix interval in seconds between downloads.
Default is 60 seconds.
- -t minimum-maximum
-
dynamic interval between a
minimum
and a
maximum
in seconds between downloads.
The interval is dynamically adjusted between the
minimum
and the
maximum
interval.
- -z timezone
-
Timezone of the time stamp in POSIX notification:
Take care in computing the sign of the time difference.
Because the time difference is the offset from local time
to UTC (rather than the reverse), its sign may be the
opposite of what you might intuitively expect.
For time zones ahead of UTC, the time difference is
negative; for those behind UTC, the difference is positive
[1].
Examples:
-z UTC England/London (Greenwich Mean Time)
-z UTC+8 USA/Santa Barbara
-z UTC+5 Peru/Lima
-z UTC-1 Switzerland/Beringen
-z UTC-2 Switzerland/Beringen (Daylight Saving Time)
-z UTC-10 Australia/Sydney
See:
https://www.timeanddate.com/time/map/
for a world map of time zones.
- -n
-
start the looped download
(-l)
in non-interactive mode to wit the
question "start download <yn>:" is automatically answered with
y.
- -i
-
create a shortcut on the
Desktop
with the selected
-l
options for later re-run of the command.
ENVIRONMENT
- TZ=timezone
-
time zone as in the
-z timezone
command line option.
EXIT STATUS
- 0
-
no error.
- 1
-
download failed (when a single file was downloaded).
- 4
-
usage message displayed.
- 5
-
version printed.
FILES
-
EXAMPLES
-
SEE ALSO
simplebackupintro(1),
sbshell(1m),
https://www.timeanddate.com/time/map/,
https://msdn.microsoft.com/en-us/library/90s5c885.aspx
NOTES
The
DownloadFile
command uses the Windows™ API to download files.
Therefore, if you are able to download a file using the
Internet Explorer,
the
DownloadFile
command is also able to download it.
Bibliography:
- [1]
-
Alphabetical Function Reference,
_tzset,
17.08.2018,
Microsoft™,
URL:
https://msdn.microsoft.com/en-us/library/90s5c885.aspx
BUGS
DownloadFile
does not handle redirects for a given URL.
AUTHOR
DownloadFile was developed by Christian Walther. Send suggestions
and bug reports to wa2l@users.sourceforge.net .
COPYRIGHT
Copyright © 2020
Christian Walther
This is free software; see
WA2LSimpleBackup/man/COPYING
for copying conditions. There is ABSOLUTELY NO WARRANTY; not
even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This document was created by man2html
using the manual pages.
Time: 16:29:46 GMT, September 14, 2024