DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far...

Welcome! This is a Q&A website for computer programmers and users alike, focused on helping fellow programmers and users. Read more

What are you stuck on? Ask a question and hopefully somebody will be able to help you out!
+2 votes

I've gone out of practice since mainly using rsync.

I basically want to use wget to get files from a remote server's subfolder. Neither end has rsync installed, but the client has wget.

https://foo.bar/path/to/directory

So I've done this:

wget -r -np -R "index.html*" https://foo.bar/path/to/directory

And while that works, I end up with empty parent directories.

I can't remember, is there a flag to only download directory without all the empty parent directories?

by

1 Answer

+1 vote
-nH
--no-host-directories

this downloads in the current working directory. You can also have a finer-grade control over how many parents you want, by using

--cut-dirs=number

and you can also add -P to specify a target folder where to save the files to

-P prefix
--directory-prefix=prefix

Another option for controlling directories download is

-l depth
--level=depth

this allows you to limit the recursion into sub-directories. For example -l 1 will only download the immediate files in a folder but not its sub-directories.

by
edited by
Contributions licensed under CC0
...