Get in touch:
01524 851 877
07718 896 553

Wget Entire Directory

Posted on May 15 2009 by Matthew Jakeman

I had the need to grab a whole directory via wget earlier which surprisingly I hadn’t needed to do before. The solution is quite simple :

wget -r -l1 --no-parent http://host/dir/
This will grab the whole directory. It basically works by telling wget to recurse (-r) but sets the level of directory recursion to 1 (-l1). The –no-parent option tells it not to follow the parent directory link.

Another handy wget command along the same lines is :

wget -r -l1 --no-parent -A.gif http://host/dir/

This is useful for just getting files of a single type. In this case it will download *.gif from the directory

Leave a comment