wget files of a certain type from multiple folders on a website

A common requirement when one is trying to download log files archived on some websites is that one needs logs from a particular date each month or from a specific date, but from all machines where the logging is being carried out.

I recently faced such a situation. I was trying to download the route views from the Packet Clearing House website. This website archives router dumps from various locations worldwide and uploads them to their server neatly arranged under various folders.

The content is organised as follows.

Home => Resources => Routing Data => IPV4 Daily Snapshots => <Year> => <Month> => <Route Location> => <Route_filename.Year.month.date.gz>

Now I needed the routing data from all locations, for 2017.04.01, so I used ‘wget‘ that is commonly available in almost all Linux installations to get the files. The wget command I used was

wget -r --accept "*.04.01.gz*" --level 2 "https://www.pch.net/resources/Routing_Data/IPv4_daily_snapshots/2017/04/"
wget files of a certain type from multiple folders on a website