October 5, 2011

Download Directories with wget

Filed under: Development,FOSS,Linux — mifan @ 6:53 am

wget is a non-interactive download utility available in the *nix OS, which can be used to remotely download files, amongst other things.

I’ve looked for the correct wget command to download a directory remotely, but couldn’t find the right one. This one, however, worked for me:

wget -r --level=3 -np -nH "<URL of Directory>"


r – recursive download (download recursively looping through sub directories

np – no parent directories (without this command, you get some weird results from the recursion working for the parent directory as well)

nH – no host (get rid of the host name – without this, your folder will be created with some weird name that includes the host/url

level=3 -upto what level/depth you want to recurse or go into. Change to an appropriate number

Check the man page of wget for more information

Blog at