Not really a question this one - but alternative answers are certainly welcome! :)
Sometimes I need to download files listed in an Apache directory listing, say as in:
... in a given directory on my computer, and I'd like to use command-line tools for that.
As far as wget is concerned, actually there are some switches that should be in place - noting that wget tends to either download single items - or to reconstruct the server folders locally!
As I just spent some half an hour figuring out what those proper switches are (to copy the remote files locally as through, say, FTP), I'd like to document them here; so the above link would be downloaded with:
wget -nd -r -l 1 http://www.gnu-darwin.org/www001/src/ports/net/samba-libsmbclient/work/samba-3.0.28/source/libsmb/
... where:
-nd
--no-directories
Do not create a hierarchy of directories when retrieving
recursively. With this option turned on, all files will get saved
to the current directory, without clobbering [...]
-r
--recursive
Turn on recursive retrieving.
-l depth
--level=depth
Specify recursion maximum depth level depth. The default maximum
depth is 5.
It would be nice to hear alternatives to the above command - maybe using different set of switches for wget - or maybe using curl or other packages...