[ubuntu-za] Wget command for sub folder on a site

Chris Schoonbee cmschoonbee at mweb.co.za
Mon Nov 4 12:17:52 UTC 2013


On 04/11/2013 08:48, Wikus wrote:
> Morning everyone ,
>
> I want to download just a sub folder on a web site , for example the 
> contents of :
>
> www.my.example/folder/
>
> So I tried the command:
>
> wget -r www.my.example/folder/
>
> But then it downloads the whole site www.my.example
>
> What am I missing in my command to only download the contents of the 
> sub folder ?
>
> Thank you
>
> - Wikus
>
There is probably a reference in /folder/ to the parent directory which 
wget will recursively follow per the -r option.
See the following option in man wget:
        -np
        --no-parent
            Do not ever ascend to the parent directory when retrieving
            recursively.  This is a useful option, since it guarantees that
            only the files below a certain hierarchy will be downloaded.

ie try wget -r -np ....

Cheers,
Chris



More information about the ubuntu-za mailing list