Grab a whole folder with wget

27 11 2009

Hey folks,

When needing to download a whole folder with wget, I’ve always run into problems with the mirror option, which is what everybody points towards when somebody asks how to achieve this. It creates massive unnecessary directory structures, leaving actually what you want hidden somewhere within. I found a command today, which circumvents this nonsense, and just downloads the contents of the folder you point it at…

wget -nd -nH -r http://www.site.dir/name/goes/here

The -nd can also be entered as –no-directories in verbose form. This stops the command creating the folder hierarchy on your local machine.

The -nH (–no-host-directories) stops the command from creating a folder labelled with the domain name at the top of the hierarchy (in the example above – http://www.site.dir).

Works a charm!

n00b

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: