Weblog entry #6 for nicc777

A quick mirror script for the lazy
Posted by nicc777 on Sun 12 Mar 2006 at 10:13
Tags: none.

I finally have some time to contribute again...

There are many tools to mirror a site, and the most common is almost certain to be wget(1). The problem with these programs - CLI or GUI - is all the options available. In my case, I rarely have to fidle with the options. So, I created a simple brain-dead wrapper script to quickly grab an mirrir a directory from a web server:

#!/bin/sh

# mirror a site tool => ms.sh
# -        -

# usage:
#
#       ms.sh BASEDIR URL 
#
# What this program will do is to create (mkdir) the 'basedir' and then
# run 'wget' in a mirror mode to dump the site in that directory. After
# the download is complete, the script will write the source URL in a
# file called source.txt.
#
MKDIR=/bin/mkdir
WGET=/usr/bin/wget
ECHO=/bin/echo

$MKDIR -p $1
cd $1
$WGET -t 0 -nc -c -x -nH -r -l 5 -k -p -L -np $2
$ECHO $2 > $1/source.txt

$ECHO '\nOperation Completed...\n\n'

Have fun...

 

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search