Wget a directory with exact filenames?

1

1

The following works because I inserted the exact filename:

wget --referer=http://www.*****.com --cookies=on --load-cookies=cookie.txt --keep-session-cookies --save-cookies=cookie.txt http://www.*****.com/doc/GG-15252252.html

But if I just do it with the doc dir I will get a 403 error message:

Connecting to www.*****.com|***.**.***.**|:**... connected.
HTTP request sent, awaiting response... 403 Forbidden
2010-11-04 21:25:38 ERROR 403: Forbidden.

So I can't list the dir, what can I do?

Please help anybody and thanks :)!!

kaspr

Posted 2010-11-04T20:27:12.247

Reputation: 11

403 means you aren't permitted to access the file[s]. So it probably isn't possible. – Wuffers – 2010-11-04T20:33:10.963

I am permitted. I got a user and password – kaspr – 2010-11-04T20:38:05.773

Answers

1

You might need to specify the username and password as part of the wget command using the --http-user and --http-password options.

However, I think it's more likely that the webserver is configured to not generate index pages automatically, or deny access to them. This is a common way for webmasters to prevent people from getting a list of all files in a directory.

LawrenceC

Posted 2010-11-04T20:27:12.247

Reputation: 63 487

Hi ultrasawblade and thanks. I got this error when trying that:

Connecting to www.***.com|...|:80... connected. HTTP request sent, awaiting response... 405 Method Not Allowed 2010-11-05 10:49:09 ERROR 405: Method Not Allowed. – kaspr – 2010-11-05T09:50:38.947

The site is a asp.net auth with this form code: <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJOTY3MTE1MDA4ZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAgUaY3RsMDAkUkhlYWRlciRTZWFyY2hCdXR0b24FL2N0bDAwJHBoJGZzZWFyY2gkU2VhcmNoQ29yZUNvbnRyb2wkU2VhcmNoQnV0dG9uaIzURx8rrbEKPD6K4mM4D8rzvpc=" /></form> – kaspr – 2010-11-05T10:06:25.197

Ahh. Now this is making more sense. The options I mentioned above only apply if the browser itself (not through javascript) pops up a dialog asking for username/password. Anyway, 405 means the site wants a POST reply and not a GET, which is what you're sending it. wget is able to send POST replies which are the common way for a browser to respond with filled out form data. Read the wget man page to see how it works. – LawrenceC – 2010-11-05T11:02:41.823