- Just see the file date getting last modification:`
cUrl.exe -# -I https://www.rarlab.com/themes/WinRAR_Noia_Bogart_64x64.theme.rar |find "Last-Modified"
Last-Modified: Tue, 15 Dec 2009 09:50:15 GMT
- The two tasks of checking and downloading in a command: Wget -N or Curl -Z --time-cond
If you consider making use of some external tool to do, checking and downloading your update not using a VBS.script
Powershell
or C#
, for checking dates between local/remote files, I suggest trying with the Wget.exe
and/or the cUrl.exe
.
- Both the cUlr.exe and the Wget.exe, bring the support to check the dates between the archival and the archvos_remotos, where it is possible to download the latest file (updating)...
- With the use of
Wget.exe
, you could try the following command:
@echo off && setlocal enabledelayedexpansion & cd /d "%~dp0"
set "_arq_rar=G:\SO_pt-BR\Q407637\WinRAR_Noia_Bogart_64x64.theme.rar"
set "_link_rar=https://www.rarlab.com/themes/WinRAR_Noia_Bogart_64x64.theme.rar
Wget.exe -N "!_arq_rar!" "!_link_rar!"
The Wget.exe -N will instruct the Wget.exe
to only download the file when the remote is newer than the local file pointed in the command.
- The local file must pre-exist to make this comparison...
- With the use of
cUrl.exe
, you could try the following command:
@echo off && setlocal enabledelayedexpansion & cd /d "%~dp0"
set "_arq_rar=G:\SO_pt-BR\Q407637\WinRAR_Noia_Bogart_64x64.theme.rar"
set "_link_rar=https://www.rarlab.com/themes/WinRAR_Noia_Bogart_64x64.theme.rar
cUrl -Z --time-cond "!_arq_rar!" "!_link_rar!" --output "!_arq_rar!"
The Curl.exe -Z --time-cond "! _arq_rar!" will instruct the curl.exe
to compare the date of the local file pointed in the command, with the date of the remote file present in the link, so if the remote file is newer, then it will download to the user.
- The local file must pre-exist to make this comparison...
Wget.exe 64-Bit:
https://eternallybored.org/misc/wget/1.20.3/64/wget.exe
Wget.exe 32-Bit:
https://eternallybored.org/misc/wget/1.20.3/32/wget.exe
Documentation: https://www.gnu.org/software/wget/manual/
Curl.exe 64-Bit:
https://curl.haxx.se/windows/dl-7.66.0_2/curl-7.66.0_2-win64-mingw.zip
Curl.exe 32-Bit:
https://curl.haxx.se/windows/dl-7.66.0_2/curl-7.66.0_2-win32-mingw.zip
Documentation: https://curl.haxx.se/docs/manpage.html
The above suggestions consider that the executables were added in the same folder as the cmd/bat file and it is the same folder where you will save the files, otherwise add a variable that points to the executable folder, getting:
- For use with Wget in another folder:
@echo off && setlocal enabledelayedexpansion & cd /d "%~dp0"
rem :: se usar o wget.exe ::
set "_wget=c:\pasta_do_Wget"
set "_arq_rar=G:\SO_pt-BR\Q407637\WinRAR_Noia_Bogart_64x64.theme.rar"
set "_link_rar=https://www.rarlab.com/themes/WinRAR_Noia_Bogart_64x64.theme.rar
pushd "!_Wget!" & Wget.exe -N "!_link_rar!" & popd
- For use with Curl in another folder:
@echo off && setlocal enabledelayedexpansion & cd /d "%~dp0"
rem :: se usar o cUrl.exe ::
set "_cUrl=c:\pasta_do_curl"
set "_arq_rar=G:\SO_pt-BR\Q407637\WinRAR_Noia_Bogart_64x64.theme.rar"
set "_link_rar=https://www.rarlab.com/themes/WinRAR_Noia_Bogart_64x64.theme.rar
pushd "!_cUrl!" & cUrl.exe -Z --time-cond "!_arq_rar!" "!_link_rar!" --output "!_arq_rar!" & popd
For your test, edit the relevant variables:
rem :: caso use o Wget.exe ::
set "_Wget=c:\pasta_do_Wget"
:: ou ::
rem :: caso use o cUrl.exe ::
set "_cUrl=c:\pasta_do_cUrl"
set "_arq_rar=G:\SO_pt-BR\Q407637\WinRAR_Noia_Bogart_64x64.theme.rar"
set "_link_rar=https://www.rarlab.com/themes/WinRAR_Noia_Bogart_64x64.theme.rar
To view the date before downloading and saving in a variable:
rem :: Usando cUrl.exe ::
for /f tokens^=2delims^=^>: %i in ('curl -s -v -X HEAD https://www.rarlab.com/themes/WinRAR_Noia_Bogart_64x64.theme.rar 2^>^&1 ^| find "-modified"')do (set "_dtmod=%i" & cmd /v/c echo/%i)
rem :: Usando Wget.exe ::
for /f ^tokens^=2*delims^=: %i in ('wget --server-response --spider "https://www.rarlab.com/themes/WinRAR_Noia_Bogart_64x64.theme.rar" ^2^>^&1 ^| find /i "modified"')do (set "_dtmod=%i" & cmd/v/c echo/%i)
Where is the RAR file?
– Ricardo Bohner
In a direct download link.
– Lennon