What I am trying to do is download a file from a url like this: http://www.example.com/down/files/425/document-preview?
When I visit this url in my browser, it triggers a file called for example: 425.doc this can be a pdf, rtf, txt, docx etc. file format.
wget is currently saving this file as: document-preview? is there anyway to save it as the file download that is triggered by the url?
This is what I am doing so far:
wget --save-cookies cookies.txt --post-data 'js_username=example@example.com&js_password=123456789' --keep-session-cookies parameter -p http://www.test.co.za/test/login
wget --load-cookies cookies.txt -p www.test.co.za/downloads/doc/425399/doc-preview? --keep-session-cookies
I want to change the values in a loop of the 425399 for example: from 425399 to 525399 it logs in perfectly and downloads, just want to capture filename and save it as that filename instead of doc-preview? which does not save the right file name which should be: 425399.doc
I did get this example online to do the batch download: wget www.whatever.com/folder/{1..30}.html
but my problem is the file name