E.Alderson
E.Alderson

Reputation: 3

Using wget on Linux to scan sub-folders for specific files

Using wget -r -P Home -A jpg http://example.com will result me a list of files from that website directory, what i'm searching for is how do i query a search like: wget -r -P home -A jpg http://example.com/from 65121 to 75121/ file_ 100 to 200.jpg

Example(s):

wget -r -P home -A jpg http://example.com/65122/file_102.jpg
wget -r -P home -A jpg http://example.com/65123/file_103.jpg
wget -r -P home -A jpg http://example.com/65124/file_104.jpg

Is it possible to achieve that on a Linux distro?
I'm fairly new to Linux OS, any tips are welcome.

Upvotes: 0

Views: 237

Answers (2)

aldebober
aldebober

Reputation: 66

Wget has loop

wget -nd -H -p -A file_{100..200}.jpg -e robots=off  http://example.com/{65121..75121}/

If there are only file_{100..200}.jpg It's simpler

wget -nd -H -p -A jpg -e robots=off  http://example.com/{65121..75121}/

Upvotes: 0

photoionized
photoionized

Reputation: 5232

Use a nested for loop and some bash scripting:

for i in {65121..75121}; do for j in {100..200}; do wget -r -P home -A jpg "http://example.com/${i}/file_${j}.jpg"; done; done

Upvotes: 1

Related Questions