As noted by Anthon the
-I option does not work that way. But, as you have a reference point - namely
~algorith/video-lectures/ with a listing of files there are some options. One is to parse index with other tools and re-run wget. Another is to use
--accept-regex: it matches for accept on the complete URL.
Specify a regular expression to accept or reject the complete URL.
This should do what you want:
wget -r -nd -A pdf --accept-regex "2007/.*\.pdf" 'http://www3.cs.stonybrook.edu/~algorith/video-lectures/'
-nd if you actually want the directories.
Edit (to address comment)
accept vs. accept-regex
This is somewhat cumbersome for me to explain, but I'll give it a try.
First off, if you really want to read the manual, then use
info. As stated in
man (this is from GNU wget) - (easy to overlook):
This is not the complete manual for GNU Wget. For more complete information,
including more detailed explanations of some of the options, and a number of
commands available for use with .wgetrc files and the -e option, see the GNU
Info entry for wget.
In this case i.e.:
$ info wget "Following Links" "Types of Files"
Here we find, emphasize mine:
Finally, it’s worth noting that the accept/reject lists are matched twice against downloaded files: once against the URL’s filename portion, to determine if the file should be downloaded in the first place; then, after it has been accepted and successfully downloaded, the local file’s name is also checked against the accept/reject lists to see if it should be removed.
Further it continues to explain that the rationale behind this is that
.html files are always downloaded regardless of accept/reject rules.
- They should be removed after being downloaded and scanned for links, if they did match the accept/reject lists.
Thus: HTML files are always downloaded. After it is downloaded the match is only done against the file name.
Not sure how much this helped. If you read the info page it might be more clear. It is a bit of complexity with chicken and egg things etc. in the mix here.