Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My aim is to download only the files available on websites such as those on http://pelusa.fis.cinvestav.mx/tmatos/LaSumA/LaSumA2_archivos/NumeRCPs/ansi/index.htm under the "Access via Directories:" title. How can I achieve my aim I am not familiar with wget and I do not want to obtain the html files, I would like to download only the *.c and *.h files on that site for example. Is it possible? I think downloading specific file types and saving to a desired place is a function provided by wget.

share|improve this question

closed as off-topic by Sneetsher, Mitch May 6 at 17:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – Sneetsher, Mitch
If this question can be reworded to fit the rules in the help center, please edit the question.

    
I may write a script which make that, but I'm not sure if there is already a program which does it. Anyone knows? –  Vlad Apr 14 at 10:28
2  
@Vlad WebHTTrack can manage downloading types. –  Danatela Apr 14 at 10:37

3 Answers 3

up vote 2 down vote accepted

This will retrieve all .c and .h files:

wget -r -l1 --no-parent -A c,h http://pelusa.fis.cinvestav.mx/tmatos/LaSumA/LaSumA2_archivos/NumeRCPs/ansi/recipes/

Result will be a directory structure

pelusa.fis.cinvestav.mx/
tmatos/
LaSumA/
LaSumA2_archivos/
NumeRCPs/
ansi/
recipes/

and the .c and .h files will be in recipes/ (it will not save in the same target directory since that could overwrite files).


There are other tools that might be easier, like lftp (it supports globbing better than wget).

share|improve this answer
    
Thanks for your reply can the two separate commands be combined so that both c files and h files are retrieved with the execution of a single command? –  Vesnog Apr 14 at 10:46
    
here: gnu.org/software/wget/manual/html_node/Types-of-Files.html It is easier than that :) edit: hmm playing with it and wget seems to not follow its own manual >:D –  Rinzwind Apr 14 at 10:56

Most times it's quite more handy to stick to the browser (assuming firefox): Therefore you need a kind of download manager:

FoxySpider (https://addons.mozilla.org/de/firefox/addon/foxyspider/) does recursive fetching of files for specified types of files (file extensions) ("Well, actually get any file type you want from an entire website").

Also DownThemAll (http://www.downthemall.net/) does it ("DownThemAll lets you download all the links or images contained in a webpage and much more: you can refine your downloads by fully customizable criteria to get only what you really want.").

share|improve this answer
    
Well this is a nice suggestion I think it supports the same functionality in different OSs, am I right? –  Vesnog Apr 14 at 10:47
    
surely: used that for years on any kind of windows and Linux at least, also Ubuntu –  SLN Apr 14 at 10:49
    
+1 for downthemall with this you can easily download all kind of data. Even streamed video are possible with a bit of hacking. –  jnovacho Apr 14 at 12:33

In flareget download manager, you can use batch downloader to achieve the same. It supports wild cards too. In file menu click batch download or you can even import links from a website using import option.

http://flareget.com

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.