Created
December 3, 2015 19:37
-
-
Save maphew/0f2f1b4f3659440bae82 to your computer and use it in GitHub Desktop.
Download National Hydrographic Network for Yukon Territory and surround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: rev 0.1 2008.Mar.10, [email protected] | |
:: rev 0.2 2008.Sept.18 - updated to account for change in ftp source folders | |
:: rev 0.3 2014.Feb.06 - enable timestamp (only download if source newer) | |
echo. | |
echo. ----------------------------------------------------------------------- | |
echo. Going to download National Hydrographic Network Yukon, which could take | |
echo. awhile. This script can be aborted and rerun, it will resume | |
echo. where it left off. | |
echo. ----------------------------------------------------------------------- | |
ping -n 6 localhost >nul | |
setlocal | |
:: Ensure we download next to this script, in case of being started from UNC path. | |
pushd %~dp0 | |
echo. Saving files to %~dp0 (as %cd%) | |
call :ChkReqs wget.exe | |
popd | |
goto :EOF | |
:ChkReqs | |
:: test for wget, if it is in path we can carry on. | |
if exist "%~$PATH:1" ( | |
call :Download ) else ( | |
echo %1 not found! can't continue | |
) | |
goto :End | |
:Download | |
set urlRoot=ftp://ftp2.cits.rncan.gc.ca/pub/geobase/official/nhn_rhn/gdb_en/ | |
:: Change these region numbers as required for your area of interest | |
:: http://www.geobase.ca/geobase/en/find.do?produit=nhn | |
set QuadList=09 10 08 | |
:: Change 'gdb' to 'shp' if that is your prefence; 'en' to 'fr' pour francais | |
:: 'wait' options are to take it easy on the host server. | |
set opts=--random-wait --wait 1 --accept *gdb_en.zip --no-verbose --recursive --continue --timestamping | |
for %%a in (%QuadList%) do ( | |
wget --level=3 --no-host-directories --cut-dirs=4 %opts% %urlRoot%/%%a | |
) | |
goto :End | |
:End | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment