I'm using wget to download all files from within a folder using the -r and -np options. However this also downloads the preceding folders, which I don't want.
For example:
wget -r -np ftp://user:pass@352.525.255.54/articles/artist/images/
this downloads all files from within "images" (which is good) but then also downloads the folders articles, artist and images (which is bad). What option fixes this?
Best Answer
I think what you are looking for is the
--cut-dirs
option. Used in conjunction with the-nH
(no hostname) option, you can specify exactly which level of directory you want to appear in your local output. As an example, I have a .pkg download that I want to write to my local directory, and I don't want all of the parent tree to be included, just the subdirectories. In this case, my starting point to just get the .pkg name as the parent directory is 5 levels down:What you will see, then, is the name driver_C123_105.pkg in your current directory.
[...etc...]
[.....etc....]
You can direct this output to go elsewhere with the
-P
option.