#!/bin/bash ############################################################# # Author : Timothy Lim Sheng Hwee # E-mail : limshenghwee@gmail.com # Blog : http://blog.thewheatfield.org # License : Public Domain - i.e. do what you want with it =) ############################################################# save_dir=`dirname "$0"` folder=`date "+%Y-%m-%d"` if [ "$save_dir" = "." ]; then save_dir=`pwd`/; else save_dir=$save_dir/; fi echo $save_dir; echo "================================"; echo "| Download directory: $save_dir"; echo "================================"; echo "| Storing files in: $folder"; echo "================================"; if [ ! -d "$save_dir$folder" ] then mkdir "$save_dir$folder"; fi url='http://www.bt.com.bn/e-paper/images/'; file_start='page'; file_end='_zoom.jpg'; i=1; echo "dld log:" "$save_dir"dld.log; if [ -a "$save_dir"dld.log ] then rm "$save_dir"dld.log fi while [ 1 ]; do file="$file_start$i$file_end"; output="$save_dir""$folder""/""$file"; echo "Downloading: $file"; wget -c $url$file -O "$output" -a "$save_dir"dld.log if [ -s "$output" ] then echo "Download done. Next file..."; else rm "$output" echo "Download completed" break; fi let i+=1; done