Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to use WGET to download files from a server. I am using a batch file with the following line:

wget -q http://subs.ro/get/22463

The file is downloaded but the name is wrong and there is no file extension, when I try to download the same file using IE or MF, I get usually an archive (rar or Zip).

Any help will be appreciated.

C.

share|improve this question

migrated from stackoverflow.com Oct 31 '09 at 18:09

This question came from our site for professional and enthusiast programmers.

    
this is more apropos for superuser or serverfault. –  Jherico Oct 31 '09 at 16:49
    
I am trying to put together a little program for personal use that can download subtitles from that site. –  Anonymous Oct 31 '09 at 17:20

2 Answers 2

Use the --content-disposition option to wget.

share|improve this answer
    
I am not sure how to use that option, I tried using it directly wget --content-disposition http://subs.ro/get/22463 and this is what I got C:\Users\>wget --content-disposition subs.ro/get/22463 wget: unrecognized option --content-disposition' Usage: wget [OPTION]... [URL]... Try wget --help' for more options. I can't find any other details on this oprion even on google. Thx. C. –  Anonymous Oct 31 '09 at 16:30
    
i am using the GnuWin32 wget 1.11.4 on Windows, and it has the --content-disposition option (though marked as experimental). try upgrading your version of wget –  Adrien Plisson Oct 31 '09 at 16:51
    
The manual here describes it: gnu.org/software/wget/manual/wget.html. It does say that it's "experimental". You probably have an older version of wget. –  Ned Oct 31 '09 at 16:51
    
I have the latest version as well, I just needed to add '', unfortunately it still doesn't work, same thing as before. –  Anonymous Oct 31 '09 at 17:19

I just ran the same command (on the same link) and then checked what downloaded:

$ file 22463
22463: Zip archive data, at least v2.0 to extract

Unzip confirms:

$ unzip -tl 22463
Archive:  22463
    testing: Paranormal Activity.srt   OK
No errors detected in compressed data of 22463.

Now, since what you download is a zipfile, you just need to rename it. To do this from wget, you can use the -O (capital letter) switch:

$ wget http://subs.ro/get/22463 -O foo.zip
[...]
2009-10-31 16:42:56 (39.1 KB/s) - `foo.zip' saved [30656/30656]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.