wget - Download a sub directory

sura2k picture sura2k · Jul 16, 2012 · Viewed 52.3k times · Source

How do I download only a sub directory using wget? Can I specify the subdirectory that I need to download?

Thanks!

Answer

Aamir picture Aamir · Nov 18, 2012

You can do:

wget -r -l1 --no-parent http://www.domain.com/subdirectory/

where:

-r: recursive retrieving
-l1: sets the maximum recursion depth to be 1
--no-parent: does not ascend to the parent; only downloads from the specified subdirectory and downwards hierarchy