wget command that retains the directory structure code example

Example: wget command that retains the directory structure

## Sometimes we want to create the same directories when downloading files using wget.
## To do this is simple! Just use the -x switch to create the same directory structure (if it does not exist).
## For example:

wget -x www.somedomain.com/dir1/dir2/dir3/some-file.txt;

## This will save the file in the following directory structure that gets created if it does not exist:
## www.somedomain.com/dir1/dir2/dir3/some-file.txt

## If you would like to leave out the host name, then use the -nH switch.
## Dor example: 

wget -x -Nh www.somedomain.com/dir1/dir2/dir3/some-file.txt;

## This will save the file in the following directory structure that gets created if it does not exist:
## dir1/dir2/dir3/some-file.txt

## Happy coding, my homies <3

Tags:

Misc Example