Categories: Development

Wget cut directory and no host command

When doing a recursive download with Wget the whole directory structure is saved, starting with the domain/hostname and then working down the directory tree inside it.

Preventing this action and downloading recursively into a directory is done using the cut dir command.

This is its syntax:

--cut-dirs=

Along with the no host parameter which is

-nH

This cuts out the hostname only from your targetted address.

If I was downloading from this address

https://website.com/folder/another/here

The files would be stored in https://website.com/folder/another/here folder structure, however using

-nH --cut-dirs=1

Would recursively download the files into /another/here

-nH --cut-dirs=2

would go into /here

Using just

-nH

Saves into /folder/another/here

Share
Tags: How toWget

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago