Last active
September 15, 2018 09:05
-
-
Save d3banjan/9b8d13d502e94773c1e3d3b52058a6a8 to your computer and use it in GitHub Desktop.
download large files in chunks
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
#! /bin/bash | |
LARGE_FILE_URL="http://vatic2.stanford.edu/stanford_campus_dataset.zip" | |
APPROX_SIZE=`echo "69*1024*1024*1024"| bc` | |
CHUNKSIZE=`echo "128*1024*1024" | bc` | |
NCHUNKS=`echo "1+ (($APPROX_SIZE)/($CHUNKSIZE))" | bc` | |
STARTCHUNK="1" | |
OUTDIR="/media/debanjan/xxx" | |
OUTFILE="stanford_campus_dataset.zip" | |
SLEEP_INTERVAL="10" | |
for ichunk in $(seq -f '%05g' 1 $NCHUNKS); | |
do | |
from=`echo "($ichunk-1)*$CHUNKSIZE" | bc` | |
to=`echo "$ichunk*$CHUNKSIZE - 1"| bc` | |
curl --range "$from-$to" "$LARGE_FILE_URL" -o "$OUTDIR/$OUTFILE.$ichunk" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment