Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wget --accept files containing pattern

Tags:

string

wget

I am trying to write a script that downloads all the files linked in a certain page. These files must contain specific strings and have certain extensions. Let's say that I want to download all files that contain the string "1080" or "1080p" etc. and that have as extension ".mov" ".avi" ".wmv" etc. This was to show that both the strings and the extensions are multiple.

This is what I have done so far:

wget -Amov -r -np -nc -l1 --no-check-certificate -e robots=off http://www.example.com

Any help is really apreciated.

Thank you.

like image 454
user3161330 Avatar asked Jan 04 '14 21:01

user3161330


1 Answers

You can add a pattern for the -A switch, like this:

wget -A "*1080*mov" -r -np -nc -l1 --no-check-certificate -e robots=off http://www.example.com

This example will get all files with "1080", except gif & png files:

wget -A "*1080*" -R gif,png -r -np -nc -l1 --no-check-certificate -e robots=off http://www.example.com
like image 179
carleson Avatar answered Sep 22 '22 09:09

carleson