I am trying download files and directories inside a site at say https://www.example.com/dir1/dir2/dir3/dir4/ . What I want is that I get all the contents at this url, as in files and directories, exactly in the same way and store them in a directory named "dir" on my machine. The command I used is wget -r --no-parent -P "dir" https://www.example.com/dir1/dir2/dir3/dir4/ . But what this does is create folders in my directory as dir/dir1/dir2/dir3/dir4/..all the contents here... What I want is dir/.. All the contents here... How can I achieve that?


From man wget


Ignore number directory components. This is useful for getting a fine-grained control over the directory where recursive retrieval will be saved.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.