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?
Add a comment |
1 Answer
From man wget
--cut-dirs=number
Ignore number directory components. This is useful for getting a fine-grained control over the directory where recursive retrieval will be saved.