Created
February 23, 2015 14:46
-
-
Save petertoi/b61ac28f2cd27a2c645d to your computer and use it in GitHub Desktop.
Download sequentially named files from command line
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 | |
# | |
# Author: Peter Toi | |
# Source: https://gist.github.com/petertoi/b61ac28f2cd27a2c645d | |
# | |
# Usage 1: $ wgetseq.sh # No argument will result in prompts | |
# Usage 2: $ wgetseq.sh starturl endurl startnum endnum # Skip the prompts by including the arguments | |
if [ "$#" -eq 4 ] | |
then | |
starturl=$1 | |
endurl=$2 | |
startnum=$3 | |
endnum=$4 | |
else | |
echo "Start URL (i.e.: http://domain.com/image-): " | |
read starturl | |
echo "End URL (i.e.: .jpg): " | |
read endurl | |
echo "Start Num: " | |
read startnum | |
echo "End Num: " | |
read endnum | |
fi | |
for i in `seq $startnum $endnum`; | |
do | |
echo "Downloading: "$starturl$i$endurl | |
wget $starturl$i$endurl | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment